Compare commits
No commits in common. "2ad74832503a9964f4cff21fb339e07c034188a0" and "e6874571ca249a841ccff98c01422720c5c39e00" have entirely different histories.
2ad7483250
...
e6874571ca
22
app.js
22
app.js
|
@ -1,11 +1,11 @@
|
||||||
let person1 = {
|
let message = {
|
||||||
name: 'Mary',
|
name: 'John',
|
||||||
getName: function(){
|
regularFunction: function() {
|
||||||
return this.name;
|
console.log(this)
|
||||||
}
|
console.log('Hello ' + this.name);
|
||||||
};
|
},
|
||||||
let person2 = {
|
arrowFunction: () => console.log(this)
|
||||||
name: 'John'
|
}
|
||||||
};
|
|
||||||
let getNameCopy = person1.getName.bind(person2); // won't change context of function
|
message.regularFunction();
|
||||||
console.log(getNameCopy());
|
message.arrowFunction(); //
|
Loading…
Reference in New Issue