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