Skip to content

Stew.startsWith()

paige edited this page Nov 15, 2023 · 4 revisions

checks if it starts with stuff
type: Function

arguments:

  • ?values Any
    list of values (array or arguments) to check for
    if one of them is true it'll return true

list: pair:
const { Stew } = require('stews');


let arr = new Stew([ "abc", "def" ]);


// false because it doesn't start with that
console.log(arr.startsWith("bc"));


// true because it does start with it
console.log(arr.startsWith("abc"));


// true because it does start with one of them
console.log(arr.startsWith("bc", "abc"));
const { Stew } = require('stews');


let obj = new Stew({ abc: 0, def: 1 });


/// false because it doesn't start with that
console.log(obj.startsWith("bc"));


// true because it does start with it
console.log(obj.startsWith("abc"));


// true because it does start with one of them
console.log(obj.startsWith("bc", "abc"));
false
true
true
false
true
true