Array length must be assigned a finite positive number

When setting the length property of an existing Array object, you specified an array length that was not a positive number or zero. This error occurs when you assign a value to the length property of an Array object that is negative or not a number (NaN). Note that JavaScript automatically converts fractional numbers to whole integers.

To correct this error

  • Assign a positive whole number to the length property. There is no upper limit for the size of an array, other than the maximum integer value (approximately 4 billion). The following example demonstrates the correct way to set the length property of an Array object.

    var my_array = new Array();  
    my_array.length = 99;  
    

See also

Using Arrays