phone challenge 1
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]
Array.prototype.evenOdd = function(){
var arr = [];
for(let i = 0; i < this.length; i++) {
if(this[i]%2===0){
arr.push(true);
}else{
arr.push(false);
}
}
return arr;
}
console.log([88, 4, -2, 7, 40].evenOdd())