January 2018
Beginner
658 pages
13h 10m
English
Regular functions, like sayHiAlt, are going to have an arguments array that's accessible inside of the function:
var user = { name: 'Andrew', sayHi: () => { console.log(`Hi. I'm ${this.name}`); }, sayHiAlt() { console.log(arguments); console.log(`Hi. I'm ${this.name}`); }};user.sayHiAlt();
Now, it's not an actual array, it's more like an object with array; like properties, but the arguments object is indeed specified in a regular function. If I pass in one, two, and three and save the file, we'll get that back when we log out arguments:
var user = { name: 'Andrew', sayHi: () => { console.log(`Hi. I'm ${this.name}`); }, sayHiAlt() { console.log(arguments); console.log(`Hi. I'm ${this.name}`); }};user.sayHiAlt(1, ...Read now
Unlock full access