JavaScript Editor Ajax toolkit     Ajax website 



Main Page

An argument that calls the Array constructor is negative or not a number (NaN). Note that JScript automatically converts fractional numbers to whole integers.

To correct this error

  • Use only positive integers or the number zero when creating a new Array object. To create an array with a single element, use a two-step process. First, create an array with one element. Second, place the value in the first element (array[0]).

    The following example demonstrates the correct way to specify an array with a single numeric element.

    В CopyCode imageCopy Code
    var piArray = new Array(1);
    piArray [0] = 3.14159;

    There is no upper limit for the size of an array, other than the maximum integer value (approximately 4 billion).

See Also

Concepts

Array Use

Other Resources

JScript Reference



JavaScript Editor Ajax toolkit     Ajax website


©