Answers for "to check if a value is a array"

13

value is array

var colors=["red","green","blue"];

if(Array.isArray(colors)){
    //colors is an array
}
Posted by: Guest on July-22-2019
0

how to check value is array or not in javascript

// how to check value is array or not in javascript
const str = "foo";
const check = Array.isArray(str);
console.log(check);
// Result: false

const arr = [1,2,3,4];
const output = Array.isArray(arr);
console.log(output);
// Result: true
Posted by: Guest on January-07-2022

Code answers related to "to check if a value is a array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language