Module 4: What are default parameters?

master
Jason Zhu 2021-05-12 23:05:26 +10:00
parent 2ad7483250
commit 368314fcdd
1 changed files with 5 additions and 11 deletions

16
app.js
View File

@ -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());