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.
Helpful. Thank you!
Yes you're supposed to do that ; it's best practice :) See the fork D:)
huh, you dont have to specify var, let, etc... on variables, I like it
Thanks.
very helpful, thanks
I think there’s absolutely no need to depend on such micro-benchmarks. The real bottlenecks are somewhere else. However, each of these conversion methods has its own caveats:
v.toString()
— works well, unlessv.toString
is not a function, that is whenv
is null or undefined or when.toString
was deliberately changed or deleted (very rare case)'' + v
— works withnull
s andundefined
s too, but might give some unexpected results for such objects as:in which case
'' + v
would return'5'
(very rare case)String(v)
— works every time, correctly calls.toString
method, if an object has one, and works fornull
s andundefined
s'' + [v]
or[v].join()
— same asString(v)
(unless you modifiedArray.prototype
), with exception ofnull
s andundefined
s becoming empty strings, which can be quite usefull sometimesIn the real world, it’s fine to use any of these methods, with caution while using
v.toString()
whenv
could benull
andundefined
. Choose, what’s most convenient/legible/usefull for you and your team. Performance differences are highly negligible.does this run any slower than the return ''+num solution or the num.toString() method?
I guess he does indeed
Nice little test. One bit was a little confusing.
Took me a few minutes and a number of attempts before I figured out I was reading it wrong. You migh be able to write a bit more clearly perhaps.
But I enjoyed doing this one. Well done!
I absolutely agree with this. I think this would make for much more interesting algorithms, and a more realworld type scenario.
I'd say the Test.expect. Seeing the '\n' appear should provide enough of a clue given system constraints. I'll go ahead and switch my vote. Thanks for your awesome work!
I'm seeing the newline now, that's great! However, I'm not seeing the erroneous answer any longer. If you could add that back in, I'd be willing to mark you as good to go out the door.
This comment is hidden because it contains spoiler information about the solution
Great work on this.
I agree the kata is good to go as it stands. However, I think the author should review the solutions to ensure that the solutions most of us are coming up with, just to make sure they're within the author's intent.
Loading more items...