3 ms·
A small nitpick, but I'd like to point out that you don't need that () around `text` in your code: .then( (text) => { changes to .then( text => { Not on
by applecrazy 9y ago
A small nitpick, but I'd like to point out that you don't need that () around `text` in your code:
.then( (text) => {
changes to
.then( text => {
Not only is it much cleaner that way, but for single-argument arrow functions, it saves you the trouble of typing the parentheses.
Programmers are lazy. :)
- leppr 9y agoYou don't need braces around single-statement if/else/for blocks either, but you put them anyway because you're a good boy. Same could be argued for single-argument arrow functions. My point being, this is a debatable point.
- ge96 9y agoAnd here I thought that was language specific like how Python from what I experienced did not use semi-colons to end statements. What about an if statement checking if something is true, is it enough to just say: if (value) { // true } I have seen some shortened code that I did not write and wasn't sure it was valid but it works.
- deleted 9y ago[deleted]
- TeMPOraL 9y agoReminds me of lambdas in Java 8. It's technically allowed to omit parenthesis for single-parameter lambdas (and tools like SonarQube encourage it), but I never do that, for the sake of consistency and readability.