3 ms·
That will work, because console.log() returns undefined. It is a bit subtle for my taste, though. My suggestion for clarity is to go ahead and make the functio
by Stratoscope 5y ago
That will work, because console.log() returns undefined.
It is a bit subtle for my taste, though. My suggestion for clarity is to go ahead and make the function have a body with {}:
const upperCase = (message) => {
console.log(message);
return message.upperCase();
};
Of course you may disagree, but no argument there, as I said it's a matter of taste.
(BTW backticks, either triple or single, do not work on HN. Indent by two spaces if you want code formatting.)
- Griffinsauce 5y agoYeah, I'm working on the assumption that this code is not committed but for a quick debug. Any code that is shared shouldn't rely on that, I agree. Thanks for the tip!
- genezeta 5y agoSince most of the times I want "a quick debug" I'm already on my browser and quite probably with the dev tools already open, I prefer right-clicking on a line and using "Add Log" (in Firefox) or "Add logpoint" (in Chrome-based browsers). It avoids having to modify the source and then clean it up when I'm done.