Array Methods and Properties
Explore the essential methods and properties of JavaScript arrays in this lesson. Understand how to use push, pop, shift, and unshift methods effectively, and how properties like length and prototype help manage and extend arrays. Gain practical knowledge to handle arrays efficiently in your code.
Introduction
Array objects, like other objects, have methods and properties that let you modify or query them onto the object. These methods and properties make it easy to manage data. It is more convenient to use arrays rather than creating custom objects.
Properties of an array
The property of an array is a quality or attribute of the array. This could be the length, memory size, or any other quality. These are usually static values updated with the array. They may also be used to change a certain quality of the object.
So let’s take a look at some important properties available to us through JavaScript.
> length
The length property, a widely used property, tells you the current length of the array. Since this property is updated as the array is updated, there is no computation overhead when this property is called upon.
Let’s see this in action.