Last Updated: February 25, 2016
·
109
· shadowmarcus

functions without arguments on javascript

Some times we need to send a variable number of parameters to a function on javascript, for that reason this code is so helpful.

function varFunction( ) {
//read the lengt of the parameters that you send to the function
    for (var i = 0; i < arguments.length;  i++) 
    {
        //do someting
    }
}

Its a very simple trick to make functions with variable parameters.