I have the following object
{one : 1, two : 2, three : 3}
and I would like
[1,2]
Here my code
_.map({one : 1, two : 2, three : 3}, function(num, key){
if (key==='one' || key==='two') {
return num;
}
}); // [1, 2, undefined]
Actually I would like [1,2]
How can I improve my code?
thanks
You actually want to use
_.pickand_.values: