Sorry guys but this is very wrong, for in, loops through all properties
even the ones inherited from all prototypes, while Object.keys() and
Object.entries() do not. They are indeed very different

On Fri, Mar 4, 2016 at 1:45 PM Langdon <lang...@gmail.com> wrote:

> Ahhh, nothing.  I never think about destructuring.  Thanks!
>
> On Fri, Mar 4, 2016 at 1:41 PM, Caitlin Potter <caitpotte...@gmail.com>
> wrote:
>
>> > 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 <lang...@gmail.com> 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 <isiahmead...@gmail.com>
>> wrote:
>>
>>> Yeah, and those effectively nullify this, anyways.
>>>
>>> On Fri, Mar 4, 2016, 12:55 Simon Blackwell <syblackw...@anywhichway.com>
>>> 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
>>>>
>>>>
>>>>
>>>> *From:* es-discuss [mailto:es-discuss-boun...@mozilla.org] *On Behalf
>>>> Of *Langdon
>>>> *Sent:* Friday, March 4, 2016 11:22 AM
>>>> *To:* es-discuss@mozilla.org
>>>> *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/
>>>>
>>>>
>>>>
>>>> TIA,
>>>>
>>>> Langdon
>>>> _______________________________________________
>>>> 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
>>
>>
>>
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-- 
Thanks
- Edwin
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to