JSFiddle - React, Tailwind, and code Playground
by Fabio Dan
JavaScript
// please write a function that takes an array of numbers and returns an array of booleans indicating whether the number is even or not
// no outside resources, you CAN use the debugger tools
// [2, 5, 8, 9, 11] => [true, false, true, false, false]
// [88, 4, -2, 7, 40] => [true, true, true, false, true]
var isEven = function( array ){
return array.map( function( val ){
return Math.abs( val ) % 2 === 0;
});
}
console.log( isEven([ 88, 4, -2, 7, 40 ]));