-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path04_obj2.js
More file actions
61 lines (47 loc) · 1.18 KB
/
04_obj2.js
File metadata and controls
61 lines (47 loc) · 1.18 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
// singleTon Object
// const tinderUSer = new Object()
const tinderUSer = {}
tinderUSer.id = "123abc"
tinderUSer.name = "sam"
tinderUSer.isLoggedIn = false
// console.log(tinderUSer);
const regularUSer = {
email: "some@gmail.com",
fullname: {
userfullname: {
firstname: "Saurav",
lastname: "Jha"
}
}
}
// console.log(regularUSer.fullname.userfullname.firstname);
const obj1 = {1:"a" , 2:"b"}
const obj2 = {3:"c" , 4:"d"}
// const obj3 = {obj1,obj2}
// console.log(obj3); // it will give object in a object
// const obj3 = Object.assign({},obj1,obj2) // {} this will denote the target syntax of returning object
const obj3 = {...obj1, ...obj2}
// console.log(obj3);
const users = [
{
id:1,
email:"user1@mail.com"
},
{
id:2,
email:"user2@mail.com"
},
{
id:3,
email:"user3@mail.com"
},
{
id:4,
email:"user4@mail.com"
}
]
// console.log(users[3].id);
// console.log( Object.keys(tinderUSer))
// console.log( Object.values(tinderUSer))
// console.log( Object.entries(tinderUSer))
console.log(tinderUSer.hasOwnProperty(`id`));