JS: Array.prototype.length

By Xah Lee. Date: . Last updated: .

every array has its own string property key "length".

// Array.prototype is a true array
console.assert(Array.isArray(Array.prototype));

// therefore, it has its own property "length"
console.assert(
 Object.hasOwn(Array.prototype, "length"),
);

// value is 0
console.assert(Array.prototype.length === 0);