As mentioned in w3schools join() method, joins all elements of an array into a string, and returns the string.
So if you try the following:
console.log(new Array(6).join('a'));
I would expect to get: "aaaaaa"
but instead I get:"aaaaa", that means one less.
Can someone explain me why is that happening?
it puts the a between each element of your array, not after each one, so 6 elements has 5 joiners.
on this fiddle you can see a bit more exactly what the join is doing:
http://jsfiddle.net/YKhmp/