-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path03_objects.js
More file actions
34 lines (28 loc) · 759 Bytes
/
03_objects.js
File metadata and controls
34 lines (28 loc) · 759 Bytes
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
//singleton
//objects literals
const mySym =Symbol("Key1")
const Jsuser={
name: "Krishna",
"Full name": "Krishna kumar",
[mySym]:"myKey1",
age: 20,
location:"Patna",
email:"Krishna@gmail.com",
IsLoggedIn:false,
lastLoginDays:["Monday","Tuesday"]
}
// console.log(Jsuser.email);
// console.log(Jsuser["Full name"]);
// console.log(Jsuser[mySym]);
// Jsuser.email="Krishnakumar@gmail.com"
// // Object.freeze(Jsuser)
// Jsuser.email="Krishnakumar@gpt.com"
// console.log(Jsuser);
Jsuser.greetings=function(){
console.log("Hello World");
}
Jsuser.greetings2=function() {
console.log(`Hello js user, ${this.name}`);
}
console.log(Jsuser.greetings());
console.log(Jsuser.greetings2());