forked from BushraAlabsi/Toy_Problems
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjects.js
More file actions
36 lines (26 loc) · 1.35 KB
/
Copy pathObjects.js
File metadata and controls
36 lines (26 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// 1-define objects for 5 of your classmater containing the following keys:
// -full name
// -age
// -favorite sports
// -nationality
// and then save theme in one array called mates!
var fatima=({ full_name: "fatima almostafa" ,age:"22",favourit_sports:"basket ball",nationality:"syrian" })
var samer=({full_name: "samer salmeh" ,age:"25",favourit_sports:"football",nationality:"syrian" })
var shefaa=({full_name: "shefa almostafa" ,age:"17",favourit_sports:"basketball",nationality:"syrian" })
var mansour=({full_name: "mansour hjgh" ,age:"23",favourit_sports:"tennis",nationality:"syrian" })
var sara=({full_name: "sara hjgh" ,age:"227",favourit_sports:"tennis",nationality:"syrian" })
var mates[];
mates.push (fatima);
mates.push (khadija);
mates.push (shefaa);
mates.push (mansour);
mates.push (samer);
// 2-depending on the previous exercises , write a function that returns the older classmate from mates array.
function older classmate (){
}
// 3-write a function that takes an object as argument and returns how many keys does that object contain.
nbOfObjKeys({}) // ==> 0
nbOfObjKeys({name:"housam",age:"3"}) // ==> 2
// if you finished the above, solve the following:
// write a function that takes array of strings and returns an array of the strings that have the same length
['hi','hello','welcome','hy'] // ==> ["hi","hy"]