Module2: Demo using this keyword

Module2_Improving_Readability_with_Arrow_functions
jason.zhu 2021-05-12 12:24:02 +10:00
parent a3c7a49770
commit e6874571ca
1 changed files with 10 additions and 3 deletions

13
app.js
View File

@ -1,4 +1,11 @@
let sum2 = (num1, num2) => num1 + num2; let message = {
name: 'John',
regularFunction: function() {
console.log(this)
console.log('Hello ' + this.name);
},
arrowFunction: () => console.log(this)
}
let output = sum2(10,5); message.regularFunction();
console.log(output); message.arrowFunction(); //