Eliminar el primer personaje JavaScript
let str = 'Hello';
str = str.slice(1);
console.log(str);
/*
Output: ello
*/
Important Ibex
let str = 'Hello';
str = str.slice(1);
console.log(str);
/*
Output: ello
*/
var string = "abcd";
console.log(string.substring(3)); //"d"
let str = " hello";
str = str.substring(1);
var oldStr ="Hello";
var newStr = oldStr.substring(1); //remove first character "ello"
// Return a word without the first character
function newWord(str) {
return str.replace(str[0],"");
// or: return str.slice(1);
// or: return str.substring(1);
}
console.log(newWord("apple")); // "pple"
console.log(newWord("cherry")); // "herry"