-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
76 lines (67 loc) · 1.84 KB
/
script.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! 1).Creating Resume in JSON format :-
let data = [{
name: "Ajith",
description: "Full Stack Web Developer",
contact: {
mobile: 6380702825,
email: "ajithrs45@gmail.com"
},
address: {
doorno: "5/131-A",
streetname: "BSNL Nagar",
locality: "Ramachandrapuram",
City: "Pollachi",
State: "Tamil Nadu",
Country: "India"
},
education: {
school: {
name: "GHSS",
marks: 75.6
},
diploma: {
name: "PAPTC",
marks: 72
},
college: {
name: "PACET",
marks: 7.38,
dept: "B.E Mech"
}
},
skills: {
programmingLanguages: ["javaScript", "Python"],
interests: ["React", "Node.js", "MySQL", "MongoDB"],
tools: "git",
dataStructures: "aws"
}
}];
let a = JSON.stringify(data);
let resume = JSON.parse(a);
//! 2). Task - 2 => Printing all the objects in array by using loop :-
//! 1). for loop :-
for (let i = 0; i < resume.length; i++) {
console.log(resume[i]);
}
//! 2). for - in :-
for (let key in resume) {
console.log(
"Name :" + " " + resume[key].name + ",",
"Description :" + " " + resume[key].description + ",",
"Mobile :" + " " + resume[key].contact.mobile + ",",
"E-Mail ID :" + " " + resume[key].contact.email);
}
//! 3). for - of :-
for (let obj of resume) {
console.log(
"College Name :" + " " + obj.education.college.name + ",",
"Department :" + " " + obj.education.college.dept + ",",
"CGPA :" + " " + obj.education.college.marks
);
}
//! 4). forEach :-
resume.forEach((a) => console.log(
"Programming Languages Known :" +" "+ a.skills.programmingLanguages +",",
"Interested to learn :" +" "+ a.skills.interests
)
);