Arguments keywords

There are many things that you can do with the arguments keyword that might make the compiler in the JavaScript engine less able to optimize the code.

arguments keywords look like an array but it is not really an array.

argument keyword to array

Array.from(arguments)

Arguments keywords

function a(year, location) {
  return console.log(arguments);
}
a("2020", "seoul")
[Arguments] { '0': '2020', '1': 'seoul' }

when we invoke the function we will get arguments object.

arguments keyword without parameter.

function a(){
 console.log(arguments);
}
a()
[Arguments] {}

with empty parameters we can get arguments because on each execution context we create a new arguments object.

Leave a Reply

Your email address will not be published.

ANOTE.DEV