Learn Before
Concept
Relationship between length and numerical properties
A JavaScript array's length property and numerical properties are connected.
Several of the built-in array methods (e.g., join(), slice(), indexOf(), etc.) take into account the value of an array's length property when they're called.
Other methods (e.g., push(), splice(), etc.) also result in updates to an array's length property.
const fruits = []; fruits.push("banana", "apple", "peach"); console.log(fruits.length); // 3
0
1
Updated 2023-02-16
Tags
Object-Oriented Programming (OOP) Languages
Object-Oriented Programming
Programming Language Paradigms
General programming languages
Computing Sciences