JavaScript String.split与组

时间:2018-12-13 00:59:33

标签: javascript

当我在String.split中的正则表达式中使用分组表达式时,它导致将分隔符保留在结果中,如果没有分隔符,分隔符将会丢失。这是未记录的功能,还是我可以依靠的功能?

console.log('The quick brown fox jumped over the lazy dog.'.split(/h/g))
console.log('The quick brown fox jumped over the lazy dog.'.split(/(h)/g))

0 个答案:

没有答案