检测是否为数组或者伪数组

    1. const isArrayLike = function isArrayLike(obj) {
    2. let length = !!obj && "length" in obj && obj.length,
    3. type = toType(obj)
    4. if (isFunction(obj) || isWindow(obj)) return false
    5. return type === "array" || length === 0 ||
    6. typeof length === "number" && length > 0 && (length - 1) in obj
    7. }

    注意:这里用到toType&isFunction&isWindow方法