去除空格换行符

1、网络上的坑,基本找到的答案都是这种,但根本不行

  str.replace(/[ ]/g, ""); // 错误
  
2、正确验证方法
  str.replace(/[\r\n]/g, ""); // 正确
原文地址:https://www.cnblogs.com/wangjishu/p/15273113.html