ufeiya
Last Updated: September 23, 2016
·
3.123K
· fr0gs
Doggy

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

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

2 Responses
Add your response

28112
D487ed147b53832e540efd50b110bf64

whats the advantage over Array.isArray()?

over 1 year ago ·
28179
Doggy

I did not know about that method when I wrote this, so I'd say that virtually none :P.

over 1 year ago ·