I want to return a filtered array containing only a specified value
var messages: [{
id: 1,
name: "John",
hashtag: ["#cool"]},
{id: 2,
name: "Bob",
hashtag: ["#cool", "#sweet"]},
{id: 3,
name: "Bob",
hashtag: ["#sweet"]} ];
// supposed to return the first two items in the array
var newArray = _.where(messages, {hashtag: "#cool"});
filterwith an explicit predicate function.wherewon't match a string against an array.messages.filter(m => m.hashtag.find(h => h === '#cool'))should be a plain and simple vanilla js function that is sufficient for your needs.