Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I would do that, as it takes excess processing time and memory, and that surely must be avoided to be "the best practice".
How is using the bc programming language (https://en.wikipedia.org/wiki/Bc_(programming_language) in a shell exercise supposed to be clever/best practice? Why didn't you use pure shell?
;)
and JS community is even worse about that x) ;)
I also wrote the solution with ternary operators and was really skeptical whether this is the best way and so was seeing the arguments against it. And ya, I think you are right. Clean code looks more elegant than complex, hard-to-read, seemingly-smart-looking-code. I think simple if-else wins here over ternary operator.
That's why there is eslint no-nested-ternary rule that prevents me to commit such rubbish to production code. However it is alright in codewars as this is a platform for streching the limits of what can be done coding wise. I have learned quite a lot from such short nonsense solutions.
Could not agree more! And 16 people think this is clever! The only way of which this code is clever, is in its way of making a simple statement hard to read.
It's not much better in Python. And Python's lambda expressions are very limited compared to JS, and some some stuff can be written in a shorter way as well using JS...
And yeah, this code is totally ok as there's a way to make it even harder to decipher.
This comment is hidden because it contains spoiler information about the solution