Skip to content

isArray ​

The isArray function checks if the provided value is an array.

Syntax ​

typescript
isArray(value: any): value is any[];

Parameters ​

ParameterTypeDescription
valueanyValue to be checked

Returns ​

TypeDescription
booleanTrue if it is an array

Examples ​

typescript
isArray([]); // => true
isArray({}); // => false

Notes ​

  • Useful for type validation before performing array operations.

References ​

Released under the MIT License.