forked from AdamMomen/warmUp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwarmup5.js
More file actions
42 lines (33 loc) · 1.44 KB
/
Copy pathwarmup5.js
File metadata and controls
42 lines (33 loc) · 1.44 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
36
37
38
39
40
41
42
// 1-create a data model to represent your classmates
// -think of different attributes of your classmates? what do all of them have ?
// -create a factory function.
// -create an array to hold the classmates that you created and what you created to it .
// -write a function called displayFriend that takes a mate as an argument and returns the important information in a readable way.
// -write a function called addFriend that takes a mate as an argument and add it to you classMates arraya.
// -calculate the number of male friends that your class have by writing a function called nbOfMale.
// -Write a function searchMates that, given a query and an array of Mates,
<<<<<<< HEAD
// searches the array of mates for "matching" mate. You will decide what way you want to write your search algorithm.
function factory(array){
var newArr = [];
for (var i = 0; i < array.length; i++){
newArr.push("name: " + array[i].name + ", " + "age: " + array[i].age)
}
return newArr
}
var classMates = [{name: "ons",
age: 31},
{name: "insaf",
age: 26},
{name: "essam",
age: 18}];
function displayFriend(array){
var newArr = [];
for (var i = 0; i < array.length; i++){
newArr.push(array[i].name)
}
return newArr;
}
=======
// searches the array of mates for "matching" mate. You will decide what way you want to write your search algorithm.
>>>>>>> 53bc200a820913843d17cdb55e2d8c895974ce20