Type Checking
Using ES6 Array.isArray()
function isArray(value) {
return Array.isArray(value);
}
Using Object.prototype.toString()
function isArray(value) {
return Object.prototype.toString.call(value) === '[object Array]';
}
© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext