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.
nice
This comment is hidden because it contains spoiler information about the solution
you provide the series
This solution doesn't consider dirty inputs.
This comment is hidden because it contains spoiler information about the solution
Using
_
as a placeholder for "this identifier exists but is not being used" has precedent in other languages and in practice, which makes it preferable IMO to most other choices. It's less about being shorter and more about signalling to the reader that this variable is deliberately being ignored.Of course, JS as a language makes no actual accomodation for this. We can already completely omit unused identifiers in destructuring e.g.
let [,,baz] = ['foo','bar','baz']
, and being able to do that in function declarations as well would make sense, e.g.someArray.filter((,index) => <whatever>)
. Shame we can't.I wouldn't consider using an underscore as a parameter name any simpler than any other naming convention, but it is certainly shorter. If parameter naming length is an important design consideration for you, perhaps using the
arguments
object instead of named parameters would be a better solution.but wouldn't it have been simpler to put
_
to ignore the first parameter?Callbacks instead of anon functions make this solution more readable.
Drawback to this solution is its O(n^2 or n * m) performance when it can be done in O(n).
This comment is hidden because it contains spoiler information about the solution
What is the point of having the elem? Why can't you just leave index in the parenthesis ?
Nice and readable!
I'm finally getting the hang of this stuff. This is what I did.
how can it be clever???
But I think the questions also a Note ···−−−··· should be treated as a single word and should have a word as SOS seperately.
So, what if I input the morse as '.... . ._ .___ .._ _.. . ···−−−···' => HEY JUDE SOS
but this code will return me HEY JUDESOS
Loading more items...