Last Updated: September 23, 2016
·
15.97K
· fr0gs

Check if object is Array in javascript (ES6/Typescript)

let isArray = (data) => {
  return (Object.prototype.toString.call(data) === "[object Array]");  
}

2 Responses
Add your response

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
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