Lodash: Get an object from array of objects [duplicate]
Lodash: Get an object from array of objects [duplicate]
This question already has an answer here:
I've searched the entire Lodash docs and I'm sure it's somewhere in there, but I can't seem to find the right function.
var greeting = [
_id: 1, text: "bye",
_id: 2, text: "Hello"
]
How do I get
var greeting = [text: "bye",text: "Hello"]
I've tried using _.filter
like but it doesn't work
_.filter
_.filter(greeting, function(o)
return o.text;
);
Returns:
[ _id: "1", text: "bye" , _id: "2", text: "Hello" ]
Thanks.
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.