-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
43 lines (31 loc) · 1.03 KB
/
main.js
File metadata and controls
43 lines (31 loc) · 1.03 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
json = (require('./data'));
let jsonObj= JSON.parse(json);
console.log("/////////////////Q1///////////////////");
let logData = function() {
console.log(jsonObj);
}
logData();
console.log("/////////////////Q2///////////////////");
let logNames = function() {
for (let i = 0; i < jsonObj.people.length; i++) {
console.log( jsonObj.people[i].name);
}
}
logNames();
console.log("/////////////////Q3///////////////////");
let logNameEyes = function() {
for (let i = 0; i < jsonObj.people.length; i++) {
console.log( "the eye color of "+jsonObj.people[i].name + " is : " + jsonObj.people[i].eye_color);
}
}
logNameEyes();
console.log("/////////////////Q4///////////////////");
let logByMass = function() {
for (let i = 0; i < jsonObj.people.length; i++) {
let massn= JSON.parse(jsonObj.people[i].mass);
if(massn > 75)
console.log( "the mass of "+jsonObj.people[i].name + " is : " + jsonObj.people[i].mass);
}
}
logByMass();
/////////// THE END //////////////////////////