How to detect whether an object is an array Back

To justice whether an object is an array, you may have so much methods, but the most proper one should be like this:

function isArray(obj) {
    return Array.isArray ? Array.isArray(obj) : Object.prototype.toString.call(obj) === '[object Array]';
}

Problems of other methods, like only using Array.isArray will have some side effects under IE 8, have been discussed in here.

Empty Comments
Sign in GitHub

As the plugin is integrated with a code management system like GitLab or GitHub, you may have to auth with your account before leaving comments around this article.

Notice: This plugin has used Cookie to store your token with an expiration.