function noSpace(x){ if(x.match(/\s*/g)){ return x.replace(/\s*/g,""); }else{ return x; } }
---
function noSpace(x){ return x.replace(/\s/g, ‘‘); }
---
function noSpace(x){ var result = "" for(var index = 0; index < x.length; index++){ if(x[index] !== " "){ result += x[index]; } } return result; }
---
function noSpace(x){ return x.replace(/ /g,‘‘) }
---
function noSpace(x){ return x.split("") .map(function(val){ return val == " "?"":val }) .join(""); }
原文地址:https://www.cnblogs.com/ukzq/p/12033166.html
时间: 2024-11-05 21:37:29