var arrayList = [1, 2, 3];
if (Object.prototype.toString.call(arrayList) == '[object Array]') {
console.log("It is an array")
} else {
console.log("It is not an array")
}
if (Array.isArray(arrayList)) {
console.log("It is an array")
} else {
console.log("It is not an array")
}
Output:
It is not an array
It is not an array
No comments:
Post a Comment