Compare commits
3 Commits
2ad7483250
...
2a5ef56d42
Author | SHA1 | Date |
---|---|---|
jason.zhu | 2a5ef56d42 | |
jason.zhu | d822050bdc | |
Jason Zhu | 368314fcdd |
15
app.js
15
app.js
|
@ -1,11 +1,6 @@
|
||||||
let person1 = {
|
function display(char1, char2, char3, char4, ...others) {
|
||||||
name: 'Mary',
|
console.log(others);
|
||||||
getName: function(){
|
console.log(char1, char2, char3, char4);
|
||||||
return this.name;
|
|
||||||
}
|
}
|
||||||
};
|
let letters = 'abcdefgh';
|
||||||
let person2 = {
|
display(...letters);
|
||||||
name: 'John'
|
|
||||||
};
|
|
||||||
let getNameCopy = person1.getName.bind(person2); // won't change context of function
|
|
||||||
console.log(getNameCopy());
|
|
Loading…
Reference in New Issue