Count number of negative values in array

// Write a function that takes an array of numbers as argument
// Return the number of negative values in the array
function
myFunction
(
a
)
{

return
}
Test Cases:
myFunction([1,-2,2,-4])
Expected
2
myFunction([0,9,1])
Expected
0
myFunction([4,-3,2,1,0])
Expected
1

How to solve it

I recommend solving this challenge in a 2-step process.
First, we will filter the existing array and only keep negative values. This is done using the array.filter method that we introduced in this challenge.
Remember that this method is used to exclude elements from an array based on a certain condition. For example, we can remove all elements from an array of strings that do not contain the letter e:
const strings = ['ear', 'eco', 'sad', 'say'];
console.log(strings.filter(str => str.includes('e')));
// output: ['ear', 'eco']
For the present challenge, the condition of the filter would be: element has to be a negative number.
Then, we will count the number of elements in the remaining array using the array.length method that we introduced in this challenge.