Prädikatfunktion JavaScript
const numbers = [1,2,3,4,5,6];
// The following function is a Predicate one
// It takes a value and returns true/false
function isEven(number){
return number % 2 === 0;
}
// Create an array containing the even nbs only
const evenNumbers = numbers.filter(isEven);
console.log(evenNumbers); // [ 2, 4, 6 ]
Wissam