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
user1382306
1 Answer 1
You can use the Array.map() function:
var newArr = objects.map(function(w){ return w.firstKey; });
answered Jun 26, 2013 at 15:22
Justin Niessner
246k40 gold badges416 silver badges546 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-js