Check if object is Array in javascript (ES6/Typescript)
let isArray = (data) => {
return (Object.prototype.toString.call(data) === "[object Array]");
}
Written by Esteban
Related protips
2 Responses
whats the advantage over Array.isArray()?
over 1 year ago
·
I did not know about that method when I wrote this, so I'd say that virtually none :P.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#