JavaScript vérifie si c'est le tableau
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
}
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