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

Related questions and answers

0 votes
asked Oct 14, 2021 in Python by rajeshsharma
0 votes
asked Nov 14, 2020 in JAVA by rajeshsharma
+2 votes
asked Aug 14, 2019 in BlockChain by rahulsharma
...