First I set a variable, and set it to empty:
var str = "";
Then I split it through "&":
var strs = str.split('&');
In the end, I show strs
's length:
alert( strs.length);
It alert "1".
But I assign nothing to the 'str' variable. Why does it still have a length, should't it be zero?
.split('...').filter(Boolean)
if you didnt care about falsy values. – phil294 Nov 24 '18 at 14:24