0

I have an Array() of Object()s with keys firstKey and secondKey.

Does a function exist that can set a var equal to an Array() of all of firstKeys' values only?

If so, what is it? Libs & plugins welcome.

asked Jun 26, 2013 at 15:20

1 Answer 1

2

You can use the Array.map() function:

var newArr = objects.map(function(w){ return w.firstKey; });
answered Jun 26, 2013 at 15:22
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.