Home >Web Front-end >JS Tutorial >JavaScript minimalist introductory tutorial (3): Array_javascript skills
Reading this article requires programming experience in other languages.
In JavaScript arrays are objects (not linearly allocated memory).
Create an array via array literal:
Arrays have an attribute length (but objects do not) that represents the length of the array. The value of length is the largest integer attribute name of the array plus 1:
We can modify the length directly:
Changing the length will not cause more space to be allocated
length is changed to smaller, and all attributes with subscripts greater than or equal to length are deleted
Since arrays are also objects, you can use delete to delete elements in the array:
Deleting an element in the array will leave a hole.
JavaScript provides a set of array methods, which are placed in Array.prototype (not detailed here).