startWith()メソッドは、文字列が指定された文字列の文字で始まるかどうかを判別し、trueまたはfalseを返します。
extendsWith()メソッドとstartsWith()メソッドの構文は同じですが、endsWith()メソッドは文字列の末尾から検索します。
let str = "https://C:/Users/2/1.png";
console.log(str.startsWith("https://"))// true;
console.log(str.startsWith("http://"))// false;
console.log(str.endsWith(".jpg"))// false;
console.log(str.endsWith(".png"))// true;