JavaScript Code

How to remove first character from String?

Remove first character from String in JavaScript

Given a string value, remove first character from the string, and return the resulting string.


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. If we pass a value of 1 for index, then substr() returns the string from index=1 to index=end of the string.



1. Remove first character from the string str.

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