How to pass unlimited parameters in javascript ?

how to pass unlimited number of paramter in javascript

Many times we have a situation in which we don't know how many parameters are there in the function. 

In such cases, there is a need to pass unknown number of parameters in function and use them accordingly.

I will not take much of your time and give you a solution fast :) 

Let's check how can we get unknown number of parameter passed to a function using a small function. 

function showArguments(...args)
     for(i in args){

let number = [1,2,4,5];
let name = "codewithtush"



- get parameters from function
- pass unlimited parameters in function
- pass unlimited arguments in function
- use spread operator to pass parameter
- user spread operator to pass arguments

Thanks for reading, please feel free to contact. 

You can check out our most active blogs as well.

Post a Comment