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.
it's cool
thank you so much
Well, look. We multiply our passed price by the number of mangoes, minus every third bonus. That is, we use the floor method, which rounds any number down. We use this method to find jow many bonus mangoes we will have.
I'm new to javascript. Can someone explain to me why this works the way it does?
This comment is hidden because it contains spoiler information about the solution
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...
Apart from modifying the original object this is pretty clever. Nice one!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This way you have a cleaner global namespace. I would use this solution if I'm massively doing search queries for data on the global namespace.
If you don't need to do this I prefer the other because that way, the possible configurations are separated from the code, which in the end could be extracted to an external file so you would attach different configurations to your app on start-up or runtime and you can change its behavior dinamically without modifying the source code and recompiling.
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 is a very good solution because you don't need to modify the logicalCalc function if a new operation is needed.
This comment is hidden because it contains spoiler information about the solution
Loading more items...