Deleted


#1

In this exercise, function declarations are explained. It says to create a function declaration, and this is the output:

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

But it seems that this is not a function declaration; it is a function expression. For one, function declarations do not end in a semicolon (as specified in this lesson), but this example does. Secondly, it uses arrow function syntax.

In the subsequent lesson, 8/10, it says:

Also note function expressions end with a semi-colon since they are stored in a variable.

In this lesson, we have primarily been using a type of function expression known as an arrow function. Arrow function syntax is a shorter syntax for a function expression. You can identify arrow functions through the use of parentheses and the arrow token () =>.

Am I misunderstanding something?


#2

Please remember to post a link to the exercise when starting a new topic. Thanks.


#3

Sorry – I added it.


#4

This is what I entered for Step 1.

function isGreaterThan(numberOne, numberTwo){
  
}

At first I deliberately used greaterThan and the SCT message was,

Did you add function isGreaterThan? (paraphrased) so that would indicate the declaration is what is expected.

If you submitted the expression in your opening post and it passed, then it is the SCT that is lenient. You should, for the sake of the lesson, go back and write the correct expected code.


#5

Thank you – I had been reviewing the lesson and didn’t realize the answer I had put for the subsequent lesson was showing up in that one. Whoops… That explains it. :no_mouth:


#6

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