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.
Same solution as mine, except you don't need to split the string since you can just iterate over a string using a for or a for of loop.
Really nice!
Накой строку преобразовывать в массив если ее и так можно перебрать?
because count is an object. the ternary operation is checkin if the property (key: value) is in the count object already. if yes, it adds 1 to the stored value, if not it sets/adds the property.
so if string = 'example', the first run is going to see that count is empty, so count['e'] doesn't exist, and it will set count[e] = 1. then you have count = {e: 1}.
Can someone explain to me how the characters are ending up in the 'count' variable in this solution? I understand that it works, I'm not quite getting how.
Awesome !!
Mind blown !! Excellent !
thats so docking clever
i think he doesnt talk about his comments, he means that his solution isnt the shortest and could be better
nice!!
for..of loop, you mean - a for..in loop on a string will iterate over the indeces; a for..of loop will iterate over the characters.
when you need to add key to an object dynamically, you have to use the bracket notation. In each iteration the key takes a different value.
I think you make some unneccessry comments and it actually makes your code hard to read. For example you don't need to say 'create an empty obj'. It is pretty obivious for anyone to know what you're doing.
Niiice
love it! I'm always trying to think of ways to solve these problems like this but my brain isn't quite here yet. mines a bit longer but accomplishes the same task xD. Good job!
Loading more items...