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
console.log(evenOrNot2([88, 4, -2, 7, 40]));
//=> [true, false, true, false, false]
// [88, 4, -2, 7, 40] => [true, true, true, false, true]
function evenOrNot(arrOfNum){
var arr = []
for(var i = 0; i<arrOfNum.length; i++){
if(arrOfNum[i]%2){
arr.push(false)
} else {
arr.push(true)
}
}
return arr
}
function evenOrNot2(arr){
return arr.map((element)=>{
if(element%2){
return false
} else {
return true
}})
}