In ES6/ES2018+,
Object.keys(), Object.values(), Object.entries() seem to return concrete array types. Array.keys(), Array.values(), Array.entries() seem to return iterators.Is the reason for the disparity between these APIs?
It's a matter of time. Object.keys was introduced with ES5, iterables were introduced with ES6. However, iterators do make more sense for all of them. Thus Object.values and Object.entries probably follow Object.keys for consistency, and the array methods use the new iterator interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With