We already know the typeof [] is Object. But we want it should be return Array. For that we will create a function.
function Solution(n){
if(Array.isArray(n)){
return 'Array';
} else {
return typeof n;
}
}
We already know the typeof [] is Object. But we want it should be return Array. For that we will create a function.
function Solution(n){
if(Array.isArray(n)){
return 'Array';
} else {
return typeof n;
}
}