archives

« Bugzilla Issues Index

#2435 — Throwing on Array.from(undefined) should be reconsidered.


A contribution to test-262 shed light on the current spec that says:

Array.from(undefined)

Will actually throw a TypeError.

After discussion with Brian Terlson, we agreed that an explicit undefined that produces an empty array (or instance of whatever subclass it's called from) is more useful than the TypeError.

The proposed change is:

Array.from(arrayLike = [], mapFn = undefined, thisArg = undefined)

Where arrayLike will default to an empty array if omitted or receives explicit undefined.


Resolved per Jan 28 discussion:

https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-01/jan-28.md#arrayfrom