New Javascript student here. Currently, this is the code that I have
function trial(number) {
let arr = [11, 4, 5]
console.log("Number:", number)
setTimeout(() => {
for (let nums in arr) {
console.log("Num", arr[nums])
if (arr[nums] == number) {
console.log("A")
} else {
console.log("B")
}
}
}, 1000)
}
trial(5)
when I input trial([11])
it will wait for 1 second and gives all 3 results. How do I make it so that it will wait 1 second - print Num 11 A
, wait another second - Num 4 B
and finally another second for Num 5 B
? Thanks!