Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
How can you get the type of arguments passed to a function?
Home
JavaScript
How can you get the type of arguments passed to a function?
0
votes
asked
Oct 19, 2019
in
JavaScript
by
SakshiSharma
How can you get the type of arguments passed to a function?
argument-passing
javascript-argument
argument-in-javascript
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Oct 19, 2019
by
rajeshsharma
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
...