Echo JS 0.11.0

<~>
tracker1 517 days ago. link 2 points
This is about iterating an object... should probably also mention that if you're expecting an array, that may be null/undefined, you can use optional chaining.

    myArray?.forEach(...)

As mentioned in the article, you have Object.entries.  Should probably also mention Object.keys and Object.values.

IIRC Array.prototype.forEach was ES5 (not 6), while Object.entries was added with ES6/ES2017.

Replies

kali 517 days ago. link 4 points
> IIRC Array.prototype.forEach was ES5 (not 6), while Object.entries was added with ES6/ES2017.

Correct for forEach, it was ES5 (2009). As for Object.entries... uh, yes but not... It was added on ES2017 which is ES8. So... ok, you probably got a typo there :)

Anyway, it might also be interesting to note that on the other hand Object.keys() is quite older. It entered the standard at ES6, but was available in browsers -except obviously IE-  at least 3-4 years before that.
tracker1 514 days ago. link 1 point
My bad for double checking forEach and not entries... working from years old memory isn't always the greatest.  Like recalling IE5.0.0 and IE8 specific bugs (so glad I don't need to remember, but kind of sad as I've built up so much esoteric knowledge).