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

1 Answer

0 votes
by
Using typeof operator, we can get the type 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

0 votes
asked Feb 6, 2020 in JavaScript by rajeshsharma
0 votes
asked Jun 11, 2020 in C Plus Plus by Robindeniel
0 votes
asked Jan 27, 2020 in JavaScript by AdilsonLima
0 votes
asked Oct 19, 2019 in JavaScript by SakshiSharma
+1 vote
asked Feb 18, 2020 in Azure by rahuljain1
...