The startsWith() method determines whether the string starts with the characters of the specified string, and returns true or false.
The syntax of endsWith() method and startsWith() method is the same, but endsWith() method searches from the end of the string.
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;