[SOLVED] Remove a character at a certain position in a string – javascript


Is there an easy way to remove the character at a certain position in javascript?

e.g. if I have the string "Hello World", can I remove the character at position 3?

the result I would be looking for would the following:

"Helo World"

This question isn’t a duplicate of How can I remove a character from a string using JavaScript?, because this one is about removing the character at a specific position, and that question is about removing all instances of a character.


It depends how easy you find the following, which uses simple String methods (in this case slice()).

var str = "Hello World";
str = str.slice(0, 3) + str.slice(4);

Answered By – Matt

Answer Checked By – Pedro (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *