js replace of Examples of removing spaces from code

  • 2021-07-21 06:49:43
  • OfStack

Examples are as follows:


$("#stream_title").val().trim().replace(/\s/g,"");

trim end-to-end

. replace (/\ s/g, "") Remove the middle

Where//g is used to contain the previous,

\ s matches any white space characters, including spaces, tabs, page breaks, and so on.


Related articles: