-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
46 lines (35 loc) · 1.03 KB
/
Copy pathscript.js
File metadata and controls
46 lines (35 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
44
// objects are in {}
// they arekey value pairs
const person = [{
name: "Moin",
age : 34,
profession : "trainer",
city: "Pune",
hobbies: ['reading', 'coding', 56],
address : {street : 'kondhwa 42', flat : '3bhk'}
},{
name : "amit",
age: 28,
profession : "photographer",
hobbies : ['dancing', 'playing', 'reading'],
city : "Mumbai"
},{
name : "Rubina",
age:33,
profession : "coder",
hobbies : ['dancing', 'playing', 'reading'],
city : "Delhi"
}]
console.log(person);
console.table(person);
console.log(person[0]);
console.log(person[2]);
console.log(person[1]);
console.log(person[2].name);
// console.log(person.address);
// console.log(person.address.flat);
// console.log(person.hobbies[1]);
// const myName = document.querySelector('h2').textContent += person.name;
// const myHobby = document.querySelector('h3').textContent += person.hobbies[1];
const myName = document.querySelector('h2').textContent += person[2].name;
const myHobby = document.querySelector('h3').textContent += person[0].address.flat;