How do I find the maximum one-digit integer in an array?
Math.max(...myArray.filter((n) => Math.abs(n) < 10))
You can use filter
to get single digits and Math.max to find maximum of single digist
let Arr = [-6, -91, 1011, -100, 84, -22, 0, 1, 743];
let singleDigits = Arr.filter(e => e >= -9 && e <= 9);
if(singleDigits.length){
console.log(Math.max(...singleDigits));
}else{
console.log('there is no single digit number.')
}