Array.isArray(variable)
let arr = [1, 2, 3];
let notArr = "Hello, world!";
console.log(Array.isArray(arr)); // true
console.log(Array.isArray(notArr)); // false
/* 相比于使用 instanceof Array 或直接检查构造函数,Array.isArray() 方法更为可靠,
尤其是在变量可能来自不同的 iframe 或上下文时,它仍能正确识别数组 */