![]() |
VOOZH | about |
These are the following ways to insert a character at the end of the given string:
We can use the + operator or template literals to append the character.
Hello GFG!
String concatenation using + or template literals is an effective way to insert a character at the end of a string. This method creates a new string with the desired modification without altering the original string (since strings are immutable in JavaScript).
Hello, World!*
The slice method to extract the original string and append the new character.
Hello GFG!
Convert the string to an array, use splice to insert the character, and join the array back into a string.
Hello GFG!