-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobjcall.js
More file actions
37 lines (25 loc) · 767 Bytes
/
objcall.js
File metadata and controls
37 lines (25 loc) · 767 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
const normalPerson = {
firstName : "Saidul",
lastName : "Islam",
salary : 15000,
getFullName : function(){
console.log(this.firstName + " " + this.lastName);
},
chargeBill : function(amount , tips , tax){
this.salary = this.salary - amount - tips - tax
return this.salary
}
}
// normalPerson.chargeBill(3000);
// normalPerson.chargeBill(3000);
// console.log(normalPerson.salary);
const friendlyPerson = {
firstName : "Shymoli",
lastName : "Begum",
salary : 52000
}
//Apply Call Method
normalPerson.chargeBill.call(friendlyPerson , 5000 , 200 , 50);
console.log(friendlyPerson.salary);
normalPerson.chargeBill.apply(friendlyPerson , [5000 , 200 , 50]);
console.log(friendlyPerson.salary);