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'm 7 years late but appreciate the dialogue here!
Used the same kind of "flood" technique.
I guess the only other way is memoïsation? (which I just learned about now :) )
(edit: which I just finished now)
As far as I can see with %timeit function, your solution is somewhat faster than the one above...
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Instead, it adds a variable (which should have been a constant really) to the global namespace, and you have to modify something else if a new operation is needed.
Not sure if I follow your reasoning.
I would have preferred
but in this case, there's really no gain from separating
OPS
andlogicalCalc
. Just make it monolithic. You can still use the{ object } [ index ]
construct, which makes it easy enough to add a line if there's a need for a new operation.If you need to change the operations, you know exactly where to look for it. And the global namespace is modified exactly as much as necessary, no more, no less.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
"Clever" tends to denote a smart way of doing it, using shortcuts or different ways of using the language to complete the kata. A less-clever way of doing this would be to loop through every item in the array and build a string by hand. With such a simple kata as this one, the "clever" version is pretty straightforward and obvious to seasoned JS coders, but it's still a much better, more concise solution that any other one people have implemented.