colon(start: number,end: number,step?: number,): array
Generates an array of numbers from start to end with a specified step.
Creates an array of numbers starting from start, ending at end, and incrementing by step. If step is not provided, it defaults to 1.
Generate array from 1 to 10 with step 1
Generate array from 1 to 10 with step 1
import { assertEquals } from "jsr:@std/assert"; assertEquals(colon(1, 10, 1), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
Generate array from 10 to 1 with step 1 (should return empty array)
Generate array from 10 to 1 with step 1 (should return empty array)
import { assertEquals } from "jsr:@std/assert"; assertEquals(colon(10, 1, 1), []);
An array of numbers from start to end with a step of step.