Callback functions

PHOTO EMBED

Sat Aug 27 2022 15:55:56 GMT+0000 (Coordinated Universal Time)

Saved by @Carminos

const isOdd = (number) => { 
  return number % 2 === 1 
};

isOdd(29);
const atLeastTwo = (array, callback) => 
  array.filter(callback).length >= 2


console.log(atLeastTwo([1, 2, 3, 4, 5], isOdd));
console.log(atLeastTwo([2, 4, 6], isOdd));
console.log(atLeastTwo([1, 2, 3, 4, 5], t => t > 3));
content_copyCOPY

Write a function that takes in an array and a function isOdd. If two elements in the array are 'truth' ie. they are odd, console.log 'true'