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 = {
|
||||
name: 'Mary',
|
||||
getName: function(){
|
||||
return this.name;
|
||||
}
|
||||
};
|
||||
let person2 = {
|
||||
name: 'John'
|
||||
};
|
||||
let getNameCopy = person1.getName.bind(person2); // won't change context of function
|
||||
console.log(getNameCopy());
|
||||
let message = {
|
||||
name: 'John',
|
||||
regularFunction: function() {
|
||||
console.log(this)
|
||||
console.log('Hello ' + this.name);
|
||||
},
|
||||
arrowFunction: () => console.log(this)
|
||||
}
|
||||
|
||||
message.regularFunction();
|
||||
message.arrowFunction(); //
|
Loading…
Reference in New Issue