> Object.entries does look nice, but 2 arguments is more straightforward than a > passing around a pair.
What’s the problem with `for (let [key, value] of Object.entries(obj)) { …. }`
> As well (and perhaps more importantly), temporarily building an array of
> arrays so we can forEach it, seems way less efficient than forIn is/would be.
You might be surprised — If the pair never reaches geriatric status (old
generation/tenured space, etc), it could be allocated and cleaned up relatively
quickly.
> On Mar 4, 2016, at 1:28 PM, Langdon <[email protected]> wrote:
>
> My gripe with Object.keys is that it requires a closure to use effectively.
>
> Object.entries does look nice, but 2 arguments is more straightforward than a
> passing around a pair.
>
> As well (and perhaps more importantly), temporarily building an array of
> arrays so we can forEach it, seems way less efficient than forIn is/would be.
>
> On Fri, Mar 4, 2016 at 1:20 PM, Isiah Meadows <[email protected]
> <mailto:[email protected]>> wrote:
> Yeah, and those effectively nullify this, anyways.
>
> On Fri, Mar 4, 2016, 12:55 Simon Blackwell <[email protected]
> <mailto:[email protected]>> wrote:
> Not sure of the rationale; however, it looks like Chrome now supports
> something similar natively:
>
>
>
>
> <>https://twitter.com/malyw/status/704972953029623808?utm_source=javascriptweekly&utm_medium=email
>
> <https://twitter.com/malyw/status/704972953029623808?utm_source=javascriptweekly&utm_medium=email>
>
>
> From: es-discuss [mailto:[email protected]
> <mailto:[email protected]>] On Behalf Of Langdon
> Sent: Friday, March 4, 2016 11:22 AM
> To: [email protected] <mailto:[email protected]>
> Subject: Object.prototype.forIn
>
>
>
> My apologies if this has been discussed before (I have to imagine it has, but
> couldn't find anything).
>
>
>
> Why isn't there a `forIn` method on Object natively?
>
>
>
> Something that simply wraps this all-to-common code:
>
>
>
> var key;
>
>
>
> for (key in obj) {
>
> if (obj.hasOwnProperty(key) === true) {
>
> ...
>
> }
>
> }
>
>
>
> Example: https://jsfiddle.net/langdonx/d4Lph13u/
> <https://jsfiddle.net/langdonx/d4Lph13u/>
>
>
> TIA,
>
> Langdon
>
> _______________________________________________
> es-discuss mailing list
> [email protected] <mailto:[email protected]>
> https://mail.mozilla.org/listinfo/es-discuss
> <https://mail.mozilla.org/listinfo/es-discuss>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

