Advertisement
boris-ivanov

Untitled

Mar 30th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. Задача 2:
  2. /*
  3. Fully implement the function *createFilter* so it
  4. creates a closure over another function and returns
  5. a function that filters an array using the passed
  6. function in *createFilter*
  7. */
  8. const createFilter = (/* needs to be implemented */) => {
  9. /* needs to be implemented */
  10. }
  11. const nums = [2, 5, 19, 27, 30, 38, 40, 45, 99];
  12. const filterUnder30 = createFilter(x => x >= 30);
  13. const notUnder30 = filterUnder30(nums);
  14. console.log(notUnder30); // should be [30, 38, 40, 45, 99]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement