Q:

What does `new Array(number)` mean when creating a new array?

What does new Array(number) mean, and what does new Array() mean?  For example:
var weekday=new Array(7);
weekday[0]="Sunday";
weekday[1]="Monday";
weekday[2]="Tuesday";
weekday[3]="Wednesday";
weekday[4]="Thursday";
weekday[5]="Friday";
weekday[6]="Saturday";

A:

In days of yore, some browsers would pre-allocate some number of empty (undefined) array entries. In my opinion, it's pointless and in fact a bad habit even though that doesn't happen now. It's just a weird API and weird things are bug launchers.
Your code could be much prettier, for example:
var weekday = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];

My reason for thinking that new Array(n) is a bad idea is that the setup of the Array constructor has two modes:
new Array(22);

means to create an Array instance with 22 null entries, but
new Array(22, 23, 24);

means to create an Array instance with 3 entries.  It's confusing and weird, and really shouldn't have been done that way.

