If Rumi were a programmer. I'm really good at self-proclaimed manifestos. Too reckless to be an entrepreneur. Open-source fanatic. Bare-metal hardware, virtual machine, and all-computing wisdom.
===: Yeah, I just picked up this habit, as it is usually the safer option, especially when processing external/user input.
return: JS is one of the langs without implicit returns. Nevertheless in the middle of a function we need to be explicit anyway, since more code follows afterwards. If implicit returns were supported you could use an else block to avoid a keyword, but also not worth the effort.
If Rumi were a programmer. I'm really good at self-proclaimed manifestos. Too reckless to be an entrepreneur. Open-source fanatic. Bare-metal hardware, virtual machine, and all-computing wisdom.
Yeah I was hoping es6 is closer to functional than this. The only way to get an implicit return from the last expression is a lambda function without brackets (containing a single expression).
One fix needed:
needs to be
(also uses
===as best practice)Otherwise an error happens:
Oh, shoot! Thank you. I thought that could implicitly return.
About the
===it's very funny because now we don't have to use==again, although it is totally fine for integers like this case.===: Yeah, I just picked up this habit, as it is usually the safer option, especially when processing external/user input.return: JS is one of the langs without implicit returns. Nevertheless in the middle of a function we need to be explicit anyway, since more code follows afterwards. If implicit returns were supported you could use an else block to avoid a keyword, but also not worth the effort.Yeah I was hoping es6 is closer to functional than this. The only way to get an implicit return from the last expression is a lambda function without brackets (containing a single expression).
And for the brain version:
Or
undefinedwill be the only result.