Master the Art of Debugging

Boost your Frontend Development expertise by mastering Bug-Solving skills through engaging practical challenges.

Explore bugs
export const filterEvenNumbers = (array: number[]) => {
  let evenNumbers = [];
  for (let i = 0; i < array.length - 1; i++) {
    if (array[i] % 2 === 0) {
      evenNumbers.push(array[i]);
    }
  }
  return evenNumbers;
};

const output = filterEvenNumbers([1, 2, 3, 4, 5, 6]);
console.log("Output:", output); // expected output: [2, 4, 6]
Loading bug