-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobj.js
35 lines (31 loc) · 873 Bytes
/
obj.js
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
let chethan = {
name: 'Chethan',
tech: 'JS',
year: 1993,
calcAge: function (bYear) {
return 2019 - bYear;
},
otherCalcAge: function () {
return 2019 - this.year;
},
newAge: function () {
return this.age = 2019 - this.year;
}
}
console.log('--------------',chethan.calcAge(1993));
console.log('+++++++++++++++', chethan.otherCalcAge());
console.log('=================', chethan);
// -------------------------Object comparision --------------------------------------------
var jangoFett = {
occupation: "Bounty Hunter",
genetics: "superb"
};
var bobaFett = {
occupation: "Bounty Hunter",
genetics: "superb"
};
var callMeJango = jangoFett;
// Outputs: false
console.log('%%%%%%%%%%%%%%%%%%', bobaFett === jangoFett);
// Outputs: true
console.log('#################', callMeJango === jangoFett);