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.
While we all want to write more readable code, just remember that 'readability' sometimes depends on our ability to read! More advanced code may seem unreadable for beginners but may actually be very readable and concise the more one learns...
That is not a performance hit. If
(1 + percent / 100)
actually affected performance, then something is wrong with your ALU.You cache things that are expensive, not arithmetic.
Additionally, this solution computes the modifying percentage for each iteration:
(1 + percent / 100)
This is an unnecessary performance hit. The value should be cached before the loop body for this solution to qualify as a Best Practice.
I'd argue that it's not best practice to put a loop on a single-line (especially without braces).
It's possible, but then again a lot of crazy things are possible in JS.
Best practice is absolutely about avoiding hard to read one-liners, which is why this is an easy to read four-liner.
I don't understand why this has so many votes for best practices. I can understand clever, but isn't best practice avoiding hard to read one-liners?