亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - When the value of String is the same as String.split('') parameter one and is not empty, the length of the split array is greater than 0?
伊謝爾倫
伊謝爾倫 2017-05-19 10:30:28
0
1
665

When the value of String is the same as String.split('') parameter 1 and is not empty, the length of the split array is 2. Use String.substr(1).split('') to split the array. The array length is 1
For example:

let a = ','
a.split(',')
//返回結(jié)果 ["",""], a.length為2
a.substr(1).split(',')
//返回結(jié)果 [""], a.length為1
a = ''
a.split('') 
//返回結(jié)果[], a.length為0
伊謝爾倫
伊謝爾倫

小伙看你根骨奇佳,潛力無限,來學(xué)PHP伐。

reply all(1)
黃舟

You don’t understand String.prototype.substr().

a.substr(1) means: starting from index 1 (the second position) and ending at the end of the string.
So what we get here is the null character.

So split did not match and returned itself (empty string).

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template