Module2: Demo using this keyword
parent
a3c7a49770
commit
e6874571ca
13
app.js
13
app.js
|
@ -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);
|
||||
console.log(output);
|
||||
message.regularFunction();
|
||||
message.arrowFunction(); //
|
Loading…
Reference in New Issue