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 was taught that its best practice to use else if/else over ternary operators, as else if/else are easier to read.
You shouldn't need a 'smartass solution.' Alternating y = +/- 1 values on intervals of PI ad infinitum, with y = 1 and x = 0 being one of those points, is equivalent to cos(x). Doing a large enough set of intervals should get you close to cos(x).
Hint: You need to implement nested iteration: an outer loop to handle the summation, and an inner iteration to handle the product. The most common way of doing this is with for loops. My solution uses the reduce method on arrays. Hope this helps.
True, I could just assign a percentage var and then return at the end.
You are right! I agree that not inheriting from
Object.prototype
for a simple map is better practice, never really thought about that one, I just always use{}
. I have changed theequals()
function. It should work withObject.create(null)
now. Thanks for reporting this.Look StackOverFlow or other CW solutions, you will see how it's easy to truncate, whatever language you use, even in JS! Rounding is a bit less easy and informative.
What do you propose?
But efficient ;)
And who says I have to play the good boy every single time :D?