Megahnanda Bintang Megahnanda Bintang -4 years ago 85
Javascript Question

Javascript Code to Append a String Each Character

i have this string:


i want to append a string
each character above:



please help me, i have searched this in stackoverflow, but no result..

please forgive me about my bad English. :)


Answer Source

The easiest way is to use regular expression in .replace():

"Abcd".replace(/./g, "$&Z");

Here /./g will match all symbols in the given string and $& will insert them in the output.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download