How to check if a variable is array in JavaScript

1 Answer

0 votes
const arr = ["javascript", "php", "c++", "python"];
var n = 12;

document.write(Array.isArray(arr) + "<br />");

document.write(Array.isArray(n) + "<br />");
 
 
/*
run:
       
true
false
     
*/

 



answered Nov 4, 2019 by avibootz

Related questions

1 answer 213 views
1 answer 236 views
1 answer 303 views
2 answers 330 views
1 answer 226 views
...