JS Built-ins
← Array226 / 226
ArrayArray.prototype.toLocaleStringbeginner

Empty Array toLocaleString

πŸ“– Usage Example
const arr = []
arr.toLocaleString()  // β†’ ''  (empty string)

toLocaleString() on an empty array returns an empty string.

Array.prototype.toLocaleString β€” Empty Array

Calling toLocaleString() on an empty array returns an empty string ''. This is consistent with toString() and join() behavior on empty arrays.

Implement emptyLocaleString() that returns ([] as number[]).toLocaleString().

πŸ’‘ Hints (2)
  • β€’ An empty array has no elements to convert, so `toLocaleString()` returns `""`.
  • β€’ This mirrors the behavior of `[].toString()` and `[].join(",")`.