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 = {
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());
function sayHi(message, name = 'World') {
console.log(message + " " + name);
}
sayHi("Hello");
sayHi("Hi", 'John');