Here are three ways to remove the first character from a string in JavaScript.
- Using slice()
- Using substring()
- Using replace()
Method 1: Using the slice()
To remove the first character from the string in JavaScript, you can use the “slice()” method. The string.slice() is a built-in method that extracts a part of a string. It does not change the original string.
Syntax
string.slice(startIndex, endIndex);
Example
let string = "Greetings from JavaScript";
string = string.slice(1)
console.log(string);
Output
reetings from JavaScript
Method 2: Using the substring() function
You can use the substring() method to remove the first character of a string in JavaScript. The substring() method also accepts two parameters: one is the starting number of the index, and the second is the endindex number.
But if we pass only one parameter, by default, it will consider the first parameter as 0.
Syntax
string.substring(startIndex, endIndex);
Example
let string = "Greetings from Javascript";
string = string.substring(1)
console.log(string);
Output
reetings from Javascript
Using the substring() method, we removed the first character “G” from the string using the substring() method.
Don’t use the “substr()” method to remove the first character from a string in JavaScript because it is deprecated and won’t be available in the future. You can learn more about this on Mozilla docs.
Method 3: Using the replace() method
The String.replace() is a built-in JavaScript method that searches a string for a value or a regular expression. It only replaces the first occurrence of the matched string.
Syntax
string.replace(searchValue, newValue)
Example
let string = "Greetings from Javascript";
let firstChar = string.charAt(0);
const newString = string.replace(firstChar, '');
console.log(newString)
Output
reetings from Javascript
Conclusion
The most efficient way to remove the first character from a string in JavaScript is to use the string.slice() method.
Related posts
How to Get Last Character from String in Javascript
How to Get First Character of String in JavaScript
How to Get Character from String in JavaScript

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.