Search

Print function with dynamic arguments



Dynamics Arguments in JavaScript

Since Arguments for a function do not have to be specified in the function definition we can pass any number of arguments to it.

//print function with dynamic arguments 
var print = new Function("for(var i=0; i < arguments.length; i++) document.writeln(arguments[i]);");
//now this print function can be called from any number of parameters, as
print("say","hello","to","javascript","this","is ","awesome");