Using the arguments object to read any and all parameters passed to a function
function myFunction() { for (let i = 0; i < arguments.length; i++) { console.log(i + ": " + arguments[i]); }// w w w. j a va2 s . c o m } myFunction("Hello", 21, new Date());