forked from mtahir08/cmad-javascript
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathobjets.txt
48 lines (20 loc) · 756 Bytes
/
objets.txt
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
1) var obj1 = { name:"abc", email:"[email protected]"}
var obj2 = obj1;
obj2.name = "xyz";
console.log(obj1);
console.log(obj2);
//When an object variable is copied
–the reference is copied, the object is not duplicated.
3) var obj1 = { name:"abc", email:"[email protected]"}
var obj2 = { name:"abc", email:"[email protected]"}
obj1 == obj2; //true or false?
2) Consider question #1;
obj1 == obj2 // true or false?
3) var obj1 = { name:"abc", email:"[email protected]"}
var obj2 = obj1;
delete obj2.name
console.log(obj1);
console.log(obj2);
5) var obj1 = { name:"abc", email:"[email protected]"};
var obj2 = Object.assign({}, obj1);
//var obj2 = Object.assign({}, obj1,{name:"jhon"},{pass:"123"},{name:"Alice",pass:'456'});