delete first character javascript
snippet in javascript

delete first character javascript

user9865

let str = 'Hello';
 
str = str.slice(1);
console.log(str);
 
/*
    Output: ello
*/

remove first char javascript

user389

let str = 'Hello';
 
str = str.substring(1);
console.log(str);
 
/*
    Output: ello
*/

delate char betwen index js

user1499

// First find the substring of the string to replace, then replace the first occurrence of that string with the empty string.

S = S.replace(S.substring(bindex, eindex), "");

//Another way is to convert the string to an array, splice out the unwanted part and convert to string again.

var result = S.split("");
result.splice(bindex, eindex - bindex);
S = result.join("");