Module 4: What are default parameters?
parent
2ad7483250
commit
368314fcdd
16
app.js
16
app.js
|
@ -1,11 +1,5 @@
|
||||||
let person1 = {
|
function sayHi(message, name = 'World') {
|
||||||
name: 'Mary',
|
console.log(message + " " + name);
|
||||||
getName: function(){
|
}
|
||||||
return this.name;
|
sayHi("Hello");
|
||||||
}
|
sayHi("Hi", 'John');
|
||||||
};
|
|
||||||
let person2 = {
|
|
||||||
name: 'John'
|
|
||||||
};
|
|
||||||
let getNameCopy = person1.getName.bind(person2); // won't change context of function
|
|
||||||
console.log(getNameCopy());
|
|
Loading…
Reference in New Issue