in JavaScript by
Q:
How can you get the total number of arguments passed to a function?

1 Answer

0 votes
by
Using arguments.length property, we can get the total number of arguments passed to a function. For example −

function func(x){

   console.log(typeof x, arguments.length);

}

func();                //==> "undefined", 0

func(1);               //==> "number", 1

func("1", "2", "3");   //==> "string", 3
Click here to read more about JavaScript
Click here to read more about Insurance

Related questions

+1 vote
asked Apr 16, 2020 in QuickTest Professional (QTP) by Robindeniel
0 votes
asked Jun 7, 2019 in Data Handling using R by tempuser
0 votes
asked Jun 11, 2020 in C Plus Plus by Robindeniel
0 votes
asked Jan 21, 2020 in ECMAScript by GeorgeBell
0 votes
asked May 23, 2020 in SAP by Robindeniel
...