JavaScript Code

How to remove first character from String?


Problem Statement

given a string, remove first character from the string

Solution

to remove first character from the given string in JavaScript, use String.substr() method. substr() method can take index as argument and returns the substring from the specified index till the end of the string

str.substr(index)

Program

remove first character from the string str

let str = 'helloworld';
let output = str.substr(1);
console.log(output);