-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
95 lines (84 loc) · 2.2 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// QUESTION 1:
// JSON ITERATE USING FOR LOOP
let keys=['ayesha','nooja','sheeba','sowbia','divya']
let values=[1,2,3,4,5]
let person={}
for(let i=0; i<keys.length;i++)
{
person[keys[i]]=values[i]
}
// console.log(person);
//output=>{ayesha: 1, nooja: 2, sheeba: 3, sowbia: 4, divya: 5}
// ayesha:1
// nooja:2
// sheeba:3
// sowbia:4
// divya:5
//JSON ITERATE USING FOR IN
const data={
name:'ayesha',
age :21,
sex :'female'
}
for(let keys in data)
{
// console.log(keys+":" ,data[keys])
}
//output name: ayesha
// age: 21
// sex: female
//JSON ITERATE USING FOREACH
let fav=['video','book','java','year'];
let items=['play','reader','script',2000];
let solution={}
fav.forEach((fav,i)=>{
solution[fav]=items[i]
});
// console.log(solution);
//output=>{video: 'play', book: 'reader', java: 'script', year: 2000}//book: "reader
//java: "script"
//video: "play"
//year: 2000
//JSON ITERAITON USING FOR OF
let cars={'ford':1,'toyota':2,'honda':3,'volkswagen':'fav'}
let k= Object.keys(cars)
for(let i of k)
{
console.log(`${i} : ${cars[i]}`);
}
//output=>ford : 1
// toyota : 2
// honda : 3
// volkswagen : fav
//QUESTION 2:
//EASY RESUME DATA IN JSON FARMAT
let resume={
name :'ayesha nooja',
DOB : '01.09.2000',
gender :'female',
nationality :'INDIAN',
maried_status:'single',
languages_known:['tamil','english','hindi','urdu'],
degree :'BBA BANKING',
university_board:'Alagappa University',
percentage_CGPA : '78%',
year_of_passing :2022,
Experience : '3 years(part time)'
}
console.log(resume);
//output=>{name: 'ayesha nooja', DOB: '01.09.2000', gender: 'female', nationality: 'INDIAN', maried_status: 'single', …}
name : "ayesha nooja"
nationality : "INDIAN"
percentage_CGPA : "78%"
university_board: "Alagappa University"
year_of_passing : 2022
DOB : "01.09.2000"
Experience : "3 years(part time)"
degree : "BBA BANKING"
gender : "female"
languages_known : Array(4)
0: "tamil"
1: "english"
2: "hindi"
3: "urdu"
maried_status : "single"