I was reading the kata test cases to learn how you check if filter() is used, but I can't understand this :Test.assertEquals( Array.prototype.filter_used, true, "Try with filter-method" ); Could you explain where this comes from please ?
Maybe I'm wrong, but I think the real goal of this kata is not to break the code very efficiently, but to find a way to make the tryCode() function remember the last try without writing any external code. If this is the case, it should probably be stated very clearly: "Don't write any code outside of the tryCode() function".
I really had a hard time finding how to properly initialize the array in the range function, so the map function can do its job.
I don't think this exercise is 7 kyu, at least if one try to do it the functional way.
I had the same problem and I found the solution by looking at what happens when I click on "attempt" with the chrome developer tools. I saw an object like this :
{
...
reason: "TypeError: Reduce of empty array with no initial value"
...
}
So I figured that in my sum function I had to manage the case where the array is empty, and it solved my problem.
Probably the solution that makes the most sense between all those I read...
And I learned about Object.keys
OMG ! I'm afraid I choose the wrong way...
I was reading the kata test cases to learn how you check if filter() is used, but I can't understand this :Test.assertEquals( Array.prototype.filter_used, true, "Try with filter-method" ); Could you explain where this comes from please ?
Maybe I'm wrong, but I think the real goal of this kata is not to break the code very efficiently, but to find a way to make the tryCode() function remember the last try without writing any external code. If this is the case, it should probably be stated very clearly: "Don't write any code outside of the tryCode() function".
!untrue must be
(1) some kind of paid to the line developer
(2) a software architect
Anyway, thanx for sharing !
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 should be 8 kyu IMHO
I really had a hard time finding how to properly initialize the array in the range function, so the map function can do its job.
I don't think this exercise is 7 kyu, at least if one try to do it the functional way.
I had the same problem and I found the solution by looking at what happens when I click on "attempt" with the chrome developer tools. I saw an object like this :
{
...
reason: "TypeError: Reduce of empty array with no initial value"
...
}
So I figured that in my sum function I had to manage the case where the array is empty, and it solved my problem.