How to check if object is an array in Javascript

First check if your js implementation supports isArray:

if (Array.isArray)
    return Array.isArray(v);

You could also try using the instanceof operator

v instanceof Array

Published: January 10 2018

blog comments powered by Disqus