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.
This comment is hidden because it contains spoiler information about the solution
They are functionally the same. This answer was made when template literals weren't widespread yet, but today they'd be preferred since they help with readability.
Hey, @AncientGeek.
There are no global variables in this solution (apart from the functions). The only symbols added to the global scope are the functions
plus
,minus
,times
,dividedBy
, andzero
throughtnine
. These are required to exist in order to pass the kata. :)I'm not sure what you mean. Whatever it is, it was a coincidence, as ES2015 wasn't really a thing back when I did this (2013)!
Someone asked me to expand on my submission! Hope it's clearer.
The global scope. We're defining
name
('zero'
,'one'
, etc) on the same scope as the outer operations (plus
,minus
,times
anddividedBy
).In a browser,
this
would be equal towindow
.Thanks!
This comment is hidden because it contains spoiler information about the solution
Ah! Need to be sneakier! :)
ps. I just submitted a less obvious albeit somewhat longer solution.
This was pretty interesting, thanks for the challenge!
That being said, I couldn't personally rank it at 1 kyu. It was quite difficult, but I come from Javascript and have only dealt with Ruby in a few very simple katas. If I hadn't to Google every bit of syntax, I wonder how much easier it'd be.. :P
I find it odd, given Ruby's reputation of insane magic tricks, that a JS background could help so much.
Am I'm just misguided, and they are actually very similar languages?
I replaced it with
{kata_id}
because it happens in multiple katas. As far as I could tell (not an exhaustive test!), in any kata that I've already solved.Yes.
The first error is upon loading the
{kata_id}/train/javascript
page. That is a POST request that returns200 OK
, but with that error in the JSON. Result: the description loads, but the preloaded solution and test cases don't.The second one happens when I try to submit a solution in this state. The attempt goes to the
undefined
route, which succeeds. Later, the WebSocket connection receives thedefer_response
error.Also, I forgot to mention: resetting the solution does nothing.
That's related to the problem I mentioned in my comment.
Date.now
should never return0
. At least not until year 285,428,751, when javascript's 53-bit integers overflow."Train Again" stopped working for me some hours ago. I can no longer re-train katas.
The request for
{kata_id}/javascript/session
yields the following error:And any code submission goes to
{kata_id}/undefined/attempt
(yes,undefined
), throwing this error:That broke solutions that depend on certain Date properties, such as
Date.now()
returning a unix timestamp.Starting your mocked singleton at
Date.now()
instead of0
should fix things.This comment is hidden because it contains spoiler information about the solution
Loading more items...