Arguments
An argument is an object created inside execution context of the function when it is invoked.
EX 1:
function greet() {
console.log(arguments);
}
greet(); // {}
EX 2:
function greetME(name) {
console.log(arguments);
}
greetME("Vijay"); // { 0: "Vijay" }
EX 3: // using spread to access arguments as array
function greetings(...args) {
console.log(args);
}
greetings("Hello", "Vijay") // ["Hello", "Vijay"]Last updated