What is wrong with this code? It should return [4, 5], however it returns [1, 2, 3, 4, 5]
const numbers = [1, 2, 3, 4, 5];
function applyOperation(n) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(n), 2000)
});
}
const res = numbers.filter(async num => {
return await applyOperation(num) > 3;
});
console.log(res);