JSFiddle - React, Tailwind, and code Playground

JavaScript

var array = [{
    number: 5,
    text: "Foo",
    color: "red"
}, {
    number: 2,
    text: "Bar",
    color: "red"
}, {
    number: 10,
    text: "Foo",
    color: "blue"
}, {
    number: 3,
    text: "Foo",
    color: "red"
}];

var maxObj = _.max(array, function (obj) {
    return obj.number;
});
var maxIndex = array.indexOf(maxObj);
console.log("MaxValue: " + maxObj.number + ", MaxIndex: " + maxIndex);


var customSum = _.chain(array)
.where({
    text: "Foo",
    color: "red"
})
.map(function (obj) {
    return obj.number;
})
.reduce(function (memo, num) {
    return memo + num;
}, 0)
.value();

console.log("Sum: " + customSum);