To get the length of an array in JavaScript, use the .length property.
const fruits = ["apple", "banana", "cherry"];
console.log(fruits.length); // Output: 3
.length gives the number of elements in the array.fruits.push("orange");
console.log(fruits.length); // Output: 4