Arrow Functions in Use the every Method to Check that Every Element in an Array Meets a Criteria

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:

If you use the {} parenthesis you need a return statement inside the function, if you don’t use those parenthesis you don’t use the return statement

@leahleen is correct. With ES6 arrow function syntax, if you are only passing a single argument, you do not need parentheses around the argument. After the arrow, {} is required when you are executing a statement or using a block body. Otherwise, if you are only executing an expression, e.g., returning a value, you don’t need the {}. And any time {} is used, a return statement is required

No () or {} needed:

x => x * 2

Use of {} required:

x => {
  if (x > 5){
    return x + " is greater than 5!";

Use of () required, but not {}:

(x,y) => x + y

Use of () and {} required:

(x,y) => {
  if (x > y){
    return x + " is greater than " + y;
  } else {
    return y + " is greater than " + x;