Help with Functions: Function Expressions


#1

I’m current on the Functions module of JavaScript where my current task is:

Refactor the function declaration to be a function expression using arrow function syntax.
Be sure to call the function at the end.

I refactored it, but my code seems to be off. Can someone help me?

const isGreaterThan (numberOne, numberTwo) => {
  if (numberOne > numberTwo) {
    return true;
  } else {
    return false;
  }
};

isGreaterThan(5, 7);
isGreaterThan(2, 8);


#2

This should be giving an error since there is no assignment.

const foo = () => {

};

Tip for future reference (not to undo the purpose of this lesson):

numberOne > numberTwo

is a boolean, so we can return it directly.

return numberOne > numberTwo;

#3

can you post the link please


#4

The OP will have solved their problem by now, being a missing = operator. Probably not much need for the link now. If you have a question about this lesson, then please start a new topic.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.