How can I remove unwanted characters from string using javascript 🤔 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I remove unwanted characters from string using javascript 🤔

String="how$a%r#e yo&u?"; How can I remove all of the symbols from this string using javascript.🤔?

16th Jan 2022, 2:54 AM
Mohammed Nihal
Mohammed Nihal - avatar
2 Answers
+ 4
U can use String.replace(regex , placeholder) var Sring="how$a%r#e yo&u?"; console.log(Sring.replace(/[^a-zA-Z ]/g , '')) Removing all special character
16th Jan 2022, 3:20 AM
Pariket Thakur
Pariket Thakur - avatar
+ 2
Pariket Thakur thank you 😊
16th Jan 2022, 3:28 AM
Mohammed Nihal
Mohammed Nihal - avatar