-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJavascriptObject.html
More file actions
124 lines (112 loc) · 2.79 KB
/
Copy pathJavascriptObject.html
File metadata and controls
124 lines (112 loc) · 2.79 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
var i;
for( i=0;i<=10;i++){
console.log(i);
}
console.log("Exit value:",i);
// var arr=[12,16,14,15,16];
// for(var i=0;i<=arr.length;i++){
// console.log(arr[i]);
// }
// var obj={
// name:"John",
// age:"27",
// loc:'Kolkata'
// }
var arr3=[
{
name:"John",
age:"27",
loc:'Kolkata'
},
{
name:"Maria",
age:"25",
loc:'USA'
},
{
name:"Johnson",
age:"28",
loc:'Kolkata'
},
{
name:"Diana",
age:"27",
loc:'Delhi'
},{
name:"Rock",
age:"24",
loc:'Kolkata'
}
]
// console.log(arr3[0]);
//for(var i=0;i<arr3.length;i++){
// console.log(arr3[i].name);
// if(arr3[i].name.startsWith('J')){
// console.log(arr3[i]);
// }
// if(arr3[i].name.includes('i')){
// console.log(arr3[i]);
// }
// if(arr3[i].age>25){
//console.log(arr3[i]);
// }
//}
// Create a array of object of students with contains(id,name,age,phone,email)
// You have to implimant the startswith and includs fucntion
// You have to chech the length of every phone number is it 10 or not?
var arr4=[
{ id:'01',
name:"John",
age:"27",
phone:'9876543210',
email:'john@gmail.com'},
{
id:'02',
name:"Ram",
age:"28",
phone:'9876556210',
email:'ram@gmail.com'
},
{
id:'03',
name:"Sam",
age:"29",
phone:'9876546780',
email:'sam@gmail.com'
},
{
id:'04',
name:"Sita",
age:"30",
phone:'9876546745',
email:'sita@gmail.com'
},{
id:'05',
name:"Gita",
age:"31",
phone:'6296546780',
email:'gita@gmail.com'
}]
for(var i=0;i<arr4.length;i++){
console.log(arr4[i].name);
//if(arr4[i].name.startsWith('J')){
//console.log(arr4[i]);
//}
//if(arr4[i].name.includes('a')){
//console.log(arr4[i]);
}
if(arr4[i].phone.length==10){
console.log(arr4[i]);
}
</script>
</body>
</html>