Object.values and/or Object.forEach ?

Rick Waldron waldron.rick at gmail.com
Fri Jun 7 11:18:40 PDT 2013


On Fri, Jun 7, 2013 at 12:57 PM, Andrea Giammarchi <
andrea.giammarchi at gmail.com> wrote:

> it comes out from time to time devs would like to have `Object.values()`
> as equivalent of `Object.keys()` except the returned array would contain
> values.
>
> Better than repeated
> `Object.keys(obj).map(function(p){return this[k];}, obj);`
> all over
>
> but probably less useful than a more generic `Object.forEach(obj,
> callback, thisValue)` where `callback` would receive `(value, key,
> originalObject)` and `thisValue` as context.
>


What order would the values be in?

Rick


>
> This is consistent with `Array#forEach` and could simplify `for/in` loops
> passing over own enumerable properties only, as keys would do.
>
> Thoughts ?
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130607/f50f921c/attachment.html>


More information about the es-discuss mailing list