Array#filter without callback function

Asen Bozhilov asen.bozhilov at gmail.com
Mon Nov 12 13:24:11 PST 2012


Hi,

Array.prototype.filter could be used to convert sparse to dense array, e.g.

[1,,,,,2,,,,,3].filter(Boolean.bind(null, true)); //[1, 2, 3]

Would be pretty straightforward if built-in filter could be called without
callback function and returns a dense array.
I guess the engines will optimize that and library authors could gracefully
iterate over index properties of arrays without checking for existance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121112/ad5e20cb/attachment.html>


More information about the es-discuss mailing list