Saturday, May 14, 2016

arguments

var add = function() {
/*
 even though we forgo specifying parameters when defining the function, we
can rely on the arguments array passed to the function to access parameters
*/
 return arguments[0] + arguments[1];
};
console.log(add(4, 4)); // returns 8

No comments:

Post a Comment