So, I realize my initial mistake was not returning the IIFE function and every method. Can someone please explain why returning the “currentValue > 0” line isn’t enough in and of itself?
function checkPositive(arr) {
// Add your code below this line
arr.every(function(currentValue) {
return currentValue > 0;
});
// Add your code above this line
}
checkPositive([1, 2, 3, -4, 5]);
// running tests
checkPositive([1, 2, 3, 4, 5]) should return true.
// tests completed
Here’s the correct answer.
function checkPositive(arr) {
// Add your code below this line
return arr.every(function(currentValue) {
return currentValue > 0;
});
// Add your code above this line
}
checkPositive([1, 2, 3, -4, 5]);
//Submit & go to the next challenge!