-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobject2.js
More file actions
94 lines (60 loc) · 1.36 KB
/
object2.js
File metadata and controls
94 lines (60 loc) · 1.36 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
// //singleton object or constructor obj
// // const score=new Object()
// // score.id=1005
// // score.name="ayesha"
// // console.log(score);
// // const Name={
// // id:1006,
// // username:{
// // fullname:{
// // firstname:"mak",
// // lastname:"kam"
// // }
// // }
// // }
// // console.log(Name.username.fullname.firstname);
// let BTS={
// groupname:'BTS',
// genre:"Hiphop",
// members:7
// }
// let BP={
// BPgroupname:'BP',
// BPgenre:"Hiphop",
// BPmembers:4
// }
// // let KPOP=Object.assign({},BP,BTS)
// // console.log(KPOP);
// //OR U CAN ALSO DO THIS SPREAD THING
// let KPOP={...BTS,...BP}
// console.log(KPOP)
// let user1=[
// {id:235,name:'holo'},
// {id:25,name:'lo'}
// ]
// console.log(user1[1].name)
// //some meythods
// console.log(Object.keys(BTS))
// console.log(Object.values(BTS));
// console.log(Object.entries(BTS))
// console.log(BTS.hasOwnProperty('groupname'));
//OBJECT DESTRUCTURING
const course={
cname:'maths',
cfees:5000,
cinstructor:'alex'
}
//alternateway through destructuring
const {cinstructor:instruc}=course
//console.log(cinstructor);
//or
console.log(instruc);
// api is just a menu card in json format
//json format
{
}
//json can be in array so the format of json can also be
arr=[
{},
{}
]