How to check if an object is array type in Node.js

2 Answers

0 votes
const o = [5, 7, 3, 0, 1, 9, 2];
  
if (Array.isArray(o)) {
    console.log("array");
}
  

  
  
/*
run:
  
array
  
*/

 



answered Jan 24, 2022 by avibootz
0 votes
const o = Array(200);
  
if (Array.isArray(o)) {
    console.log("array");
}
  
  
  
  
/*
run:
  
array
  
*/

 



answered Jan 24, 2022 by avibootz

Related questions

1 answer 227 views
1 answer 198 views
2 answers 302 views
2 answers 269 views
1 answer 203 views
1 answer 211 views
...