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.
it's very good
This comment is hidden because it contains spoiler information about the solution
Yes, i is soooo bizzzzzare!
yeah, looks like he's just too lazy to make a new variable
Oh neat!
We learned new stuff.
First and foremost "return n if n < 10" is the base case.
The map function applies a given function (in this case "int") to every item of something that is iterable. -> new for me!
Using the string function on the input n, you turn n into a string which is iterable. Therefore the map functiion can now apply a given function to each character of a string. -> the clever part!
Once the map function is done applying int to every digit, it is then all summed together.
WHAT
this kata is more than 10 years old. Classes were introduced in ES2015. (by the way, classes are no longer merely syntactic sugar for prototypal objects; private class features for instance can hardly be emulated with pre-ES2015 JavaScript)
why not use a class? I get that a class is just syntactical sugar and it's doing this under the hood but why do it like this?
makes more sense than the randomness I passed this kata with. lol
very nice!
I was feeling clever for using the sum of numbers formula and eliminating the need for an iterative method, but damn that's slick.
you don't have nothing to do, this is look like a syndrome.
I'll say, but keep in mind that this approach is more concise and efficient than your method, especially for larger numbers.
It's iterates over numbers array three times...
Does it iterates numbers array twice?
Loading more items...