That’s because the directions ask you to use an implicit return. An implicit return means that you don’t have to use explicitly use the return keyword.
This is commonly used in high order functions like map, filter, etc, or regular functions where you are only returning one expression
For example:
const addTwoNumbers = (num1, num2) => num1 + num2
If your function is larger in nature and has many expressions, then you should wrap the function body in curly brace {} and use the return keyword.
In your code here
you are missing the return keyword.
when you rewrote it, then you were using the correct implicit return that the directions asked for.
It is important to be comfortable with both the explicit return and implicit returns because you will see both in real world apps.
You can post solutions that invite discussion (like asking how the solution works, or asking about certain parts of the solution). But please don’t just post your solution for the sake of sharing it.
If you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.