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.
Written by Marco Cardona
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Tags
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#