📜  javascript 是数组或对象 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:34.091000             🧑  作者: Mango

代码示例2
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