EN
JavaScript - remove first character from string
8
points
In JavaScript, it is possible to remove the first character from the string in the following ways.
1. Using String slice()
method
// ONLINE-RUNNER:browser;
var text = "abc";
var substring = text.slice(1);
console.log(substring); // bc
2. Using String substring()
method
// ONLINE-RUNNER:browser;
var text = "abc";
var substring = text.substring(1);
console.log(substring); // bc
3. Using String replace()
method
// ONLINE-RUNNER:browser;
var text = "abc";
var substring = text.replace("abc", "bc");
console.log(substring); // bc