arrow function
This commit is contained in:
parent
11cd3b5b68
commit
fedd8c6c2c
17
playground/arrow-function.js
Normal file
17
playground/arrow-function.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
var square = x => x * x;
|
||||||
|
console.log(square(9));
|
||||||
|
|
||||||
|
var user = {
|
||||||
|
name: "Tyrel",
|
||||||
|
sayHi: () => {
|
||||||
|
console.log(arguments);
|
||||||
|
console.log(`Hi I'm ${this.name}.`);
|
||||||
|
},
|
||||||
|
sayHiAlt () {
|
||||||
|
console.log(arguments);
|
||||||
|
console.log(`Hi I'm ${this.name}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
user.sayHi(1,2,3);
|
||||||
|
user.sayHiAlt(1,2,3);
|
Loading…
Reference in New Issue
Block a user