js字符串去空格的方法
    1.使用trim()方法:该方法可以删除字符串两端的空白字符,包括空格、制表符、换行符等。如下所示:
    let str = '  hello world  ';
    let newStr = im();
    console.log(newStr); // 'hello world'
    2. 使用replace()方法:该方法可以使用正则表达式匹配所有空白字符,并将其替换为空字符串。如下所示:
    let str = '  hello world  ';
    let newStr = place(/s+/g, '');
    console.log(newStr); // 'helloworld'js 正则替换
    3. 使用正则表达式:可以使用正则表达式匹配所有空白字符,并删除它们。如下所示:
    let str = '  hello world  ';
    let newStr = place(/^s+|s+$/g, '');
    console.log(newStr); // 'hello world'
    以上就是js字符串去空格的方法,可以根据具体需求选择不同的方法。