isarray(x: unknown): x is array<any>
Checks if the input is a 1D array.
Returns true if the input is a 1D array (not a 2D array/matrix).
A valid 1D array of numbers
A valid 1D array of numbers
import { assertEquals } from "jsr:@std/assert"; assertEquals(isarray([1.4, 2.3, 3]), true);
An array with mixed types (still an array)
An array with mixed types (still an array)
import { assertEquals } from "jsr:@std/assert"; assertEquals(isarray([1, "a", {}]), true);
x is array<any>
Returns true if x is a 1D array, otherwise false.