mbeaudru / modern-js-cheatsheet

Cheatsheet for the JavaScript knowledge you will frequently encounter in modern projects.

Home Page:https://mbeaudru.github.io/modern-js-cheatsheet/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implicit VS Explicit return

jimmylandron opened this issue · comments

/*
To do an implicit return, the code must be written in a one-line sentence.

const double = (x) => {
return x * 2; // Explicit return here
}
Since there only is a return value here, we can do an implicit return.

const double = (x) => x * 2;

*/

I think the sentence explaining the implicit return should be written:
Since there is only one line here, we can do an implicit return. Or:
Since there is only one line here, there is no need to add the return keyword.