-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript19.js
77 lines (53 loc) · 1.07 KB
/
script19.js
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
let students = [
{
firstName:"chinmay",
lastName:"deshpande",
age:34,
rollNo:45
},
{
firstName:"sarika",
lastName:"pansare",
age:23,
rollNo:23
},
{
firstName:"shraddha",
lastName:"pote",
age:25,
rollNo:23
},
{
firstName:"amol",
lastName:"rao",
age:32,
rollNo:66
}
]
// printing firstName and lastName
students.forEach(function(el,index,arr){
console.log(el.firstName + " "+ el.lastName)
})
// printing name of people above 30
// program 2
students.forEach(function(el){
if(el.age > 30){
console.log(el.firstName + el.lastName)
}
})
// program 3
// add property to the object coutry:"india" to every object
students.forEach(function(el){
el.country = "india"
})
console.log(students)
// program 4
//skills:["python"]
students.forEach(function(el){
el.skills = ["python"]
})
console.log(students)
students.forEach(function(el){
el.skills.push("html")
})
console.log(students)