How can i verify how many numbers in a array is in or out a 10-20 interval (10 and 20 included) in one function? I tried but i just got it with two functions, one to verify if its out and one to verify if its in.
let array = [1,3,7,10,14,18,20,23,27]
function inInterval(e){
if (e >= 10 && e <=20) {
return e
}
}
function outInterval(e) {
if (e <10 || e>20) {
return e
}
}
let inIntervalResult = array.filter(inInterval).length
let outIntervalResult = array.filter(outInterval).length
console.log(inIntervalResult, outIntervalResult)