+ 1

What function do you use to replace all letters?

I used “Hay!”.replace(“a”,”e”) But if I added more, it would only replace first a. Can you figure out a method/function to replace or “a”’s

28th Jun 2020, 3:32 PM
Sali65
Sali65 - avatar
3 RĂ©ponses
+ 3
"Hay!".replace(/a/g, "e")
28th Jun 2020, 3:35 PM
Russ
Russ - avatar
+ 2
Use escape character "\" "Dami's brother says hi".replace(/\'/g, "‘")
3rd Jul 2020, 8:44 PM
Russ
Russ - avatar
0
How would you replace characters like this? (“ and ‘ and ` ) Would you use this? “Dami’s brother says hi”.replace(/‘ ‘/g,””)?
3rd Jul 2020, 6:20 PM
Sali65
Sali65 - avatar