end(): number | array
Returns the last index in an array or matrix.
Returns the last index of an array or matrix. For matrices, you can specify the dimension: -1 for both rows and columns, 0 for rows, and 1 for columns.
Last index of a vector
Last index of a vector
import { assertEquals } from "jsr:@std/assert"; assertEquals(end([5, 6, 3]), 2);
Last indices of a matrix
Last indices of a matrix
import { assertEquals } from "jsr:@std/assert"; assertEquals(end([[4, 5, 0], [-1, 2, -3]]), [1, 2]);
Last row index of a matrix
Last row index of a matrix
import { assertEquals } from "jsr:@std/assert"; assertEquals(end([[4, 5, 0], [-1, 2, -3]], 0), 1);
number | array
Last index or indices.