有一段代码不是特别明白
有一段代码不是特别明白
下面这段js代码,为什么每个标点(例如"," ".")会产生出一个''
```js
const p = "Bob hit a ball, the hit BALL flew far after it was hit.";
const words1 = p.toLowerCase().split(/W/);
console.log(words1);
```
结果是: [ 'bob', 'hit', 'a', 'ball', '', 'the', 'hit', 'ball', 'flew', 'far', 'after', 'it', 'was', 'hit', '' ]