VOOZH about

URL: https://www.geeksforgeeks.org/javascript/javascript-insert-character-in-js-string/

⇱ JavaScript - Insert Character in JS String - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

JavaScript - Insert Character in JS String

Last Updated : 23 Jul, 2025

In JavaScript, characters can be inserted at the beginning, end, or any specific position in a string. JavaScript provides several methods to perform these operations efficiently.

At the Beginning

To insert a character at the beginning of a string, you can use string concatenation or template literals


Output
HGFG

You can insert the character at the beginning of the given string using many other methods. Refer to this article for more methods.

At the End

To add a character to the end of a string, concatenation or template literals are often used.


Output
GFGH

You can insert the character at the end of the given string using many other methods. Refer to this article for more methods.

At a Given Position

To insert a character at a specific position, split the string into two parts and concatenate the character between them.


Output
GHFG

You can insert the character at a specific position in the given string using many other methods. Refer to this article for more methods.

Comment