An array with no prototype wouldn't have any of the iteration methods on
it; a function with no prototype wouldn't have .call/.bind/.apply - length
and name are own properties of functions, and length is an own property of
an array, so you'd get those regardless.

(`Array.from({ length: 1000 })` already creates an array of length 1000
without holes, fwiw)

On Wed, Jan 9, 2019 at 10:43 PM Sultan <thysul...@gmail.com> wrote:

> Identical to Object.create but for Arrays and Functions.
>
> This method will allow you to create arrays with no prototype.
>
> This would allow authors the ability to use array objects as state
> containers without the need to resort to index-based objects with
>
> Object.create(null, length)
>
> When you want to both use an array-like struct as both a property and
> index-able map.
>
> A side-effect of this would afford engines a strong heuristic for avoiding
> holey-array look-ups operations when there's no prototype to walk.
>
> For example the following would create an array with a length of 1000
> without "holes".
>
> const arr = Array.create(null, 1000)
>
> In addition this could also apply to functions with
>
> Function.create(null, () => {})
>
> When you want to use functions as state-containers but don't want any of
> the implicit properties(length, name) etc.
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to