1let str = 'Hello';
2
3str = str.substring(1);
4console.log(str);
5
6/*
7 Output: ello
8*/
9
1// First find the substring of the string to replace, then replace the first occurrence of that string with the empty string.
2
3S = S.replace(S.substring(bindex, eindex), "");
4
5//Another way is to convert the string to an array, splice out the unwanted part and convert to string again.
6
7var result = S.split("");
8result.splice(bindex, eindex - bindex);
9S = result.join("");
10