Tell us what’s happening:
I solved it but my question is in why a particular syntax that I used in a previous attempt was not successful.
So, I attempted to solve the case with the following
arr.every((curr) => {
curr > 0;
});
I assumed that you could use the same syntax as on .map(), .filter(), etc. as they also were non-mutating methods. But I had to use the code below. Why was the code I used above incompatible.
Note: I took it to you all because my question is very idiosyncratic, I feel, so I don’t know exactly how to phrase it succinctly.
Thank you!
Your code so far
function checkPositive(arr) {
// Add your code below this line
return arr.every(curr=> curr > 0);
// Add your code above this line
}
checkPositive([1, 2, 3, -4, 5]);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria