判断数组的最佳方法

function isArray(value) {
        if (typeof Array.isArray === "function") {
            return Array.isArray(value);
        } else {
            return Object.prototype.toString.call(value) === "[object Array]";
        }
}

 

posted @ 2016-10-11 11:33  cnjs  阅读(396)  评论(0编辑  收藏  举报