Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/array/index.ts>startsWith

A JavaScript extension package for building strong and modern applications.
Latest
function startsWith
import { startsWith } from "https://deno.land/x/ayonli_jsext@v0.9.72/array/index.ts";

Checks if the array starts with the given prefix.

Examples

Example 1

import { startsWith } from "@ayonli/jsext/array";

const arr = [1, 2, 3, 4, 5];

console.log(startsWith(arr, [1, 2])); // true
console.log(startsWith(arr, [2, 1])); // false

Parameters

arr: T[]
prefix: T[]

Returns

boolean