摘要: ES6新增了字符串的遍历器接口,使得字符串可以被for of循环遍历。 for(let v of 'abcdefg'){ console.log(v) } for(let v of 'abcdefg'){ console.log(v) } 检索字符串中的所有数字: let str = 'a,b,c, 阅读全文
posted @ 2019-06-20 15:44 叶子玉 阅读(778) 评论(0) 推荐(0)
摘要: 去除字符串首尾空格方法: str.trim() 去除字符串首尾及中间空格方法: let str = ' a b c ' str = str.replace(/\s*/g,'') console.log(str) 去除字符串首尾及中间空格方法: let str = ' a b c ' str = st 阅读全文
posted @ 2019-06-20 15:40 叶子玉 阅读(4254) 评论(0) 推荐(0)