This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Write a function called all which accepts an array and a callback and returns true if every value in the array returns true when passed as a parameter to the callback function. | |
const all = (inputArray, callback) => { | |
return inputArray.every((input) => callback(input)); | |
}; | |
const allAreLessThanSeven = all([1, 2, 9], function (num) { | |
return num < 7; | |
}); |