in JavaScript by (32.2k points)
How can you get the total number of arguments passed to a function?

1 Answer

0 votes
by (23.9k points)
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

0 votes
asked Dec 31, 2020 in Python by SakshiSharma (32.2k points)
0 votes
asked Nov 14, 2020 in JAVA by rajeshsharma (23.9k points)
+1 vote
asked Dec 27, 2022 in Digital Primer by john ganales (14.1k points)
...