Exercise 5
Exercise:
Write a function called `filterEvenNumbers` that takes an array of numbers as input and returns a new array containing only the even numbers.
Example:
function filterEvenNumbers(numbers) {
// Your code here
}
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
console.log(filterEvenNumbers(numbers)); // Output: [2, 4, 6, 8, 10]
In this exercise, you need to implement the `filterEvenNumbers` function that takes an array of numbers as input and returns a new array containing only the even numbers from the input array. The example demonstrates how the `filterEvenNumbers` function filters the even numbers from the `numbers` array and returns the result.