Answers for "javascript determine array or object"

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
0

javascript is array or object

const data = [1,2,3,4,5];const isArray = Object.prototype.toString.call(data) === '[object Array]';console.log(isArray); // trueconst data = {id: 1, name: “Josh”};const isArray = Object.prototype.toString.call(data) === '[object Array]';console.log(isArray); // false
Posted by: Guest on April-27-2021

Code answers related to "javascript determine array or object"

Code answers related to "Javascript"

Browse Popular Code Answers by Language