Let's say I have the following structure
var myArrofObjects = [
{prop1:"10", prop2:"20", prop3: "somevalue1"},
{prop1:"11", prop2:"26", prop3: "somevalue2"},
{prop1:"67", prop2:"78", prop3: "somevalue3"} ];
I need to find the min and max based on prop2, so here my numbers would be 20 and 78.
How can I write code in Underscore to do that?
_.min(),_.max()eachand set min/max vals; there's no "min/max" justminandmax. Sorting would take longer, but you could always sort and take first/last vals._minand_maxgood enough?