What is Array prototype?

New properties and methods can be added to an Array() object using the property constructor. Whenever a property is constructed, arrays are given the property and its value as default. When a method is constructed, all arrays will have access to this method.

Syntax

Array.prototype.name = value

Code

Take a look at the code below:

Copyright ©2024 Educative, Inc. All rights reserved