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 132 views
1 answer 107 views
2 answers 188 views
2 answers 136 views
1 answer 109 views
1 answer 110 views
...