I want to replace all occurrences of white space characters (space, tab, newline) in JavaScript. How to do so?
I tried:
str.replace(/ /gi, "X")
Try this:
str.replace(/\s/g, "X")