Answers for "how to know if the object is array in js"

9

Javascript is object array

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

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

check object in array javascript

var obj = {a: 5};
var array = [obj, "string", 5]; // Must be same object
array.indexOf(obj) !== -1 // True
Posted by: Guest on June-06-2020

Code answers related to "how to know if the object is array in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language