JavaScript - это массив объектов
var colors=["red","green","blue"];
if(Array.isArray(colors)){
//colors is an array
}
Grepper
var colors=["red","green","blue"];
if(Array.isArray(colors)){
//colors is an array
}
/* The Array.isArray() method indicates whether
the passed value is an array. */
let example1 = [1, 2, 3];
console.log(Array.isArray(example1)); // → true
let example2 = {a: 1, b: 2,c: 3};
console.log(Array.isArray(example2)); // → false
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