Array.isArray Last updated: 02. Dec 2024

The Array.isArray() method determines whether the passed value is an Array. It returns true if the value is an Array, and false otherwise.

Parameters

This function takes no parameters

Returns

Returns true if the value is an Array; otherwise, false.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#{
    // Test different values
    let arr = [1, 2, 3];
    let str = "Hello";
    let obj = {key: "value"};
    
    // Check if they are arrays
    write(Array.isArray(arr));  // true
    write(Array.isArray(str));  // false
    write(Array.isArray(obj));  // false
}#

Output

The #JS code above produces the output shown below:
TrueFalseFalse