const arr = [1, 2, 3];
const obj = {name: 'John Doe'};

console.log(Array.isArray(arr)); // true
console.log(Array.isArray(obj)); // false
Array.isArray(value);
// 모두 true 반환
Array.isArray([]);
Array.isArray([1]);
Array.isArray(new Array());
Array.isArray(new Array("a", "b", "c", "d"));
Array.isArray(new Array(3));

// 모두 false 반환
Array.isArray();
Array.isArray({});
Array.isArray(null);
Array.isArray(undefined);
Array.isArray(17);
Array.isArray("Array");
Array.isArray(true);
Array.isArray(false);
console.log(typeof [1, 2, 4]); // 출력: "object"
function checkArray(arr) {
    if (Array.isArray(arr)) {
        console.log("It is an array.");
    } else {
        console.log("It is not an array.");
    }
}

const argumentsObj = (function() {return arguments;}());
checkArray(argumentsObj); // 출력: "It is not an array."
Array.isArray() 메서드의 브라우저 호환성
메서드
데스크탑 Chrome
Chrome
데스크탑데스크탑 Edge
Edge
데스크탑 Firefox
Firefox
Safari
Safari
Array.isArray() 4 12 4 10.5

caniuse.com에서 더 자세한 정보를 확인해 보세요.