• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
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

Related questions

0 votes
asked Oct 14 in Python by rajeshsharma
0 votes
asked Nov 14, 2020 in JAVA by rajeshsharma
...