// JavaScript var = function (array, minValue, maxValue){ var isInLimit = function (value) { return value >= minValue && value <= maxValue; } var = function (array, func) { var results = []; array.forEach(function(element, index, array) { if (!!func(element)) { results.push(index); } }); return results; } return (array, isInLimit); }
// That's an example of using the function ([1, 5, 2, 3, 4], 1, 3);
var = function (array, minValue, maxValue){
var isInLimit = function (value) {
return value >= minValue && value <= maxValue;
}
var = function (array, func) {
var results = [];
array.forEach(function(element, index, array) {
if (!!func(element)) {
results.push(index);
}
});
return results;
}
return (array, isInLimit);
}
// That's an example of using the function
([1, 5, 2, 3, 4], 1, 3);