Javascript Array object, javascriptarray
Array objects are used to store multiple values in a single variable.
Syntax:
<Span style = "font-size: 14px;"> new Array (); new Array (size); new Array (element0, element1 ,..., elementn); </span>
ParametersSizeIs the expected number of array elements. Returned array. The length field is setSize.
ParametersElement...,ElementnYesparameter list. When these parameters are used to call the constructor Array (), the elements of the newly created Array are initialized to these values. Its length field is also set to the number of parameters.
Return Value description:
The function returns the newly created and initialized array.
If no parameter is used when the constructor Array () is called, the returned Array is empty and the length field is 0.
When a constructor is called, only one numeric parameter is passed. The constructor returns an array with a specified number and an undefined element.
When other parameters call Array (), the constructor initializes the Array with the value specified by the parameter.
When a constructor is called as a function without the new operator, its behavior is exactly the same as that when the new operator is used to call it.