How .split(" ") treat string like " "?

JavaScript Code:

const str = "     ";//5 spaces
const strSplit = str.split("");
const strSplitWithSpace = str.split(" ");
console.log(strSplit); //[ ' ', ' ', ' ', ' ', ' ' ]
console.log(strSplitWithSpace);//[ '', '', '', '', '', '' ]
console.log(strSplit.length);// 5
console.log(strSplitWithSpace.length);// 6

Question:

Why will JavaScript treat " " string like that
when method .split() with separator " " is applied to it?
The length of the created array is longer than the one with no separator…
Can anybody explain?

There are 5 spaces, so split will divide the string in 6 pieces

yes, but they are null strings, and if remove spaces from the starting string, that’s what remains