JS Built-ins
← Array128 / 226
ArrayArray.prototype.lengthbeginner

Array.prototype.length β€” empty array has length 0

πŸ“– Usage Example
const arr = []
arr.length  // β†’ 0

Check length === 0 to determine whether an array is empty.

Array.prototype.length β€” empty array

An empty array literal [] has a length of 0. This is a fundamental baseline behaviour worth knowing explicitly.

Challenge: Implement emptyLength() that returns [].length.

emptyLength() // β†’ 0
πŸ’‘ Hints (2)
  • β€’ `[].length` evaluates to `0` β€” there are no elements.
  • β€’ `0` is falsy in JavaScript.