检测是否为数组或者伪数组
const isArrayLike = function isArrayLike(obj) {
let length = !!obj && "length" in obj && obj.length,
type = toType(obj)
if (isFunction(obj) || isWindow(obj)) return false
return type === "array" || length === 0 ||
typeof length === "number" && length > 0 && (length - 1) in obj
}
注意:这里用到toType&isFunction&isWindow方法