ES6新增了字符串的遍历器接口,使得字符串可以被for of循环遍历。

for(let v of 'abcdefg'){
  console.log(v)
}
检索字符串中的所有数字:
let str = 'a,b,c,d,e,f,g,1,2,3'
console.log(str.match(/\d+/g))

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
猜你喜欢
  • 2021-07-19
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
相关资源
相似解决方案