JsArray Class
An Array exotic object (https://tc39.es/ecma262/#sec-array-exotic-objects): length follows the indices.
public sealed class JsArray : JsObject- Inheritance
JsObjectJsArray
Properties
| Name | Description |
|---|---|
| Length | Gets the value of the length property. |
Length
JsArray.csIndexers
| Name | Description |
|---|---|
| this[uint] | Gets or sets an element of the array, as array[index] does: the getter is [[Get]] (a hole, or an index beyond the length, reads the prototype chain: usually undefined) and the setter is [[Set]] in strict mode (it can extend the array). Both run the accessors and the proxies they meet, so they are used in a scope of the engine (JsEngine.Enter). |
this[uint]
JsArray.csGets or sets an element of the array, as array[index] does: the getter is [[Get]] (a hole, or an index beyond the length, reads the prototype chain: usually undefined) and the setter is [[Set]] in strict mode (it can extend the array). Both run the accessors and the proxies they meet, so they are used in a scope of the engine (JsEngine.Enter).
Parameters
indexuint- The index: from 0 to 4,294,967,294 (2³² - 2), the largest array index.
Property value
Exceptions
ArgumentOutOfRangeExceptionindexis not an array index.JsException- The element cannot be assigned (a TypeError: e.g. a frozen array), or an accessor threw an exception.
InvalidOperationException- No engine is entered on the thread, or the array or the value belongs to another engine.
Methods
| Name | Description |
|---|---|
| ToArray() | Copies the elements of the array (CreateListFromArrayLike): the length is read once, then each element is read as the indexer does. The holes are read from the prototype chain (usually undefined), and the accessors run, so a change of the array during the copy (e.g. by a getter) is visible to the next elements, but not to the length. |
ToArray()
JsArray.csCopies the elements of the array (CreateListFromArrayLike): the length is read once, then each element is read as the indexer does. The holes are read from the prototype chain (usually undefined), and the accessors run, so a change of the array during the copy (e.g. by a getter) is visible to the next elements, but not to the length.
public JsValue[] ToArray()Returns
JsValue[]
Exceptions
InvalidOperationException- No engine is entered on the thread, the array belongs to another engine, or its length is larger than
Array.MaxLength.