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 thought it wasn't allowed to use eval... meh. :(
Now I understood what you meant when saying that I can't work my way through the digits of a number in that way. I see now that JavaScript doesn't support what I was attempting, so I changed a bit and now works!
Hahaha, cheers!
I don't get it, why not? It seems just fine for my.
Strangely this works fine for Java.
I even tried to change the "for in" loop to a traditional "for" loop and still nothing. Maybe is something in JavaScript that doesn't support ? :(
You can't work your way through the digits of a number in quite that way...
I'm not being able to pass on the test but I'm pretty sure my code is right, could someone help me see what is happening ?
See, I get reproved in the test case for 153 ("Test Failed: 153 is narcissistic"), but in my function goes like this:
wich goes 3 times, since a.length is 3 so:
#1º) 153 - Math.pow(1,3) = 153 - 1 = 152
#2º) 154 - Math.pow(5,3) = 152 - 5^3 = 27
#3º) 27 - Math.pow(3,3) = 27 - 3^3 = 0
Then again, my function returns (!b), since b = 0, !0 = true
Why my code is not being accepted ?
Hope someone help me out, cheers!
Ok, I see what I did now.. ahahaha, I was "printing" instead of "returning".
shame on me!
Thanks anyway.
I'm sorry ogryzek, since you've marked your reply as a spoiler and I didn't solve the problem because I'm getting the error, I can't un-flag it, so I would appreciate if you could tell me a hint in a different way.
Cheers ! =)
While working out with the Instructions and Output tabs there's this:
"Tip: You can press Cmd + I to toggle between Instructions and Output tabs."
I don't know if this site was design only for Mac users, but in Linux and Windows we don't have the "Cmd" button.
I suggest you guys change to a more universal pattern.
Anyway, I really enjoyed this design, by far the best I've seen in a platform like this.
Cheers!
This comment is hidden because it contains spoiler information about the solution
Ok, I'm not getting it, here's my code:
def solution(value)
@new_value = "%05d" % (value)
print "Value is #{@new_value}"
end
What is wrong? It results Exactly "Value is "5 digit formatted value""