I thought of sharing this simple method of using a return statement when you use an if statement all in one line to also print out a warning.

What is going on?

Well the difference is that console.log() will be executed, when the statement “console.log(…)” is followed by a comma “,” then the last expression will be use for the return value;

The above is a shorthand of the following code which are both equal.