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
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#