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 probably a brittle solution, but for the strings provided ...
this one is the GOAT
This basically means "Give me an array of letters from sorted input array's first item" ;)
That's a great site! Thanks for the link, never heard of it before.
You need to wrap those values with brackets
[]
, because what you posted isn't an array. Using "3 dots" on a string returns an array of characters.See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax
i don't understand why the three dots (...), return us an array and not something like this :
"paolo","zarate","azorsa","daniel".
i replaced the ...s with those values: "paolo","zarate","azorsa","daniel", to see what is going on, but i gives me an error.
!
is a regular character in JS regex, but?
is a special character (the "zero or one" quantifier in this specific instance) which has to be escaped./!/g how did it work without scaping like this /?/g
Do you know what a pure function is? Look it up if you don't.
If the solution to this kata were a pure function, it will clearly not work. Therefore...
um i don't understand how??? i have looked at it for a while and i can't figure it out. i mostly d ojava, but javascript is really simiar.
!! is used to convert a truthy/falsy value to its boolean equivalent.
let num = 5; (truthy)
!num // false
!!num // true
let num = 0; (falsy)
!num // true
!!num // false
comparing 5 with !!5 would be the equivalent of comparing 5 with true (which is false)
5 === !!5
5 === true
The only reason people still use it over Boolean (other than wanting to look like elite hackers) is because it's something like 10-15% faster (last time I checked)
Yes there is an issue with the test cases.
They should add a test case like the one you lay out here.
Try that in regex101.com And there is no need to ask the same three times.
What do the brackets [ ] do?
Awesome solution, dude!
Loading more items...