-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobject.js
More file actions
77 lines (63 loc) · 1.6 KB
/
Copy pathobject.js
File metadata and controls
77 lines (63 loc) · 1.6 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
75
//? object
//? key value pair
//? collection of primary data type
const studentDetails={}
console.log(studentDetails,typeof studentDetails);
const obj1={}
const obj2={}
console.log(obj1===obj2)//? false
// let student1={
// firstname:"Rohan",
// lastname:"Thakuri",
// isGraduated:true,
// permanentAddress:"Kathmandu",
// temporaryAddress:"Chitwan",
// };//? created the object called student1
// console.log(student1)
// console.log(`My name is ${student1.firstname}`)
// //? access technique
// //? dot operator
// console.log(student1.permanentAddress)
// console.log(student1.firstname)
// //? square bracket operator
// //? must stringify i.e convert key to string
// console.log(student1["isGraduated"]);
// console.log(student1["lastname"]);
//? CRUD
//? C=Create/Add
//? R=Read/Retrieve
//? U=Update/Edit
//? D=Delete/Remove
let student12={
firstname:"Rohan",
lastname:"Thakuri",
isGraduated:true,
Address:{
permanentAddress:"Kathmandu",
temporaryAddress:"Chitwan",
},
};
console.log(student12.Address.permanentAddress)
console.log(student12["Address"]["permanentAddress"]);
console.log(student12.Address["temporaryAddress"]);
//?Update/Insert
student12.firstname="Smarika";
student12.age=23;
console.log(student12)
let nationDetail=
{
name:"Nepal",
population:"30 million",
perCapita:1400,
};
//? delete
console.log(nationDetail)
// delete nationDetail.perCapita;
// console.log(nationDetail)
const cupDetails={
name:"watercup",
brand:"Milda",
color:"Green",
name:"Tea cup"//? the last name is priority
};
console.log(cupDetails)