Examples are as follows:
$("#stream_title").val().trim().replace(/\s/g,"");
Trim to the beginning and end
.replace(/\s/g,"") Go to the middle
where / /g
\s matches any whitespace characters, including spaces, tabs, page breaks, etc.
The above example of js replace() removing spaces in the code is all the content I share with you. I hope you can give you a reference and I hope you can support me more.