-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjects.js
More file actions
45 lines (31 loc) · 930 Bytes
/
Objects.js
File metadata and controls
45 lines (31 loc) · 930 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
35
36
37
38
39
40
41
42
43
44
45
// singleton
// Object.create
// objects literals
const mySym = Symbol("key1");
const JsUser = {
name:"mohsin",
"full name":"Md Mohsin Haider", // other type to acces <stander>
[mySym]:"mykey1", // symbole dec in object
age:18,
location:"hell",
email:"devil@google.com",
isLoggedIn:false,
lastLoggedIn:["monday", "Saturday"]
}
// console.log(JsUser.email);
// console.log(JsUser.full name); // not acces
// console.log(JsUser["full name"]);
// console.log(JsUser["email"]);
// console.log(JsUser[mySym]);
JsUser.email = "devil@chatgpt.com";
// Object.freeze(JsUser)// lock the value of JsUser from change
JsUser.email = "devil@Microsoft.com";
// console.log(JsUser);
JsUser.greating= function(){
console.log("Hello Js Users");
}
JsUser.greatingTwo= function(){
console.log(`Hello Js Users , ${this.name}`);
}
console.log(JsUser.greating());
console.log(JsUser.greatingTwo());