startsWithの読み方

startsWithの読み方

javascriptで利用されるメソッドの1つである「startsWith」の読み方を掲載してます。

読み⽅

スターツウィズ」と読みます。

英訳

「starts」は「開始」という意味があります。

startsWithとは

javascriptで、文字列の先頭に指定した文字列が含まれているかを判定するメソッドとなります。

const str = "sebee";

console.log( str.startsWith('s') ); // true
console.log( str.startsWith('se') ); // true
console.log( str.startsWith('seb') ); // true
console.log( str.startsWith('t') ); // false

// 位置の指定も第二引数で可能

console.log( str.startsWith('eb',1) ); // true
console.log( str.startsWith('bee',2) ); // true