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.
!! 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)
not an issue
Nice idea. But it doesn't work with all values in JS. For example it returns true with 1 and 2
From description:
""xor" only returns true if EXACTLY one of the two expressions evaluate to true."
Duplicate.
What's that? :b
Sample tests + random tests added
This comment is hidden because it contains spoiler information about the solution
There are two things missing in this Kata that would definitely make it easier to understand.
Other than that, this was a great Kata!
I managed to do it through pure logic. I can't say if my solution is the most efficient, but it was successful without any guesswork.
Thanks for your appreciations :)
Random test cases are difficult to implement for this kind of problems, in fact in my python version I've not implemented that :P, for other languages I'll ask the translators to fix that as soon as possible.
Yep, as your description says that was more difficult than expected.
Have you considered the following scenarios in your tests?
simplify('7-3x+4')
-> 3-3xsimplify('3c4a2b')
-> 24abcThis is a really fun kata and I enjoyed solving it. My only issue was that I ran into an intermittent bug with the random test cases in Javascript. Based on my understanding of the kata, I believe my solution should have been valid (and my solution passed after re-submitting it immediately after). I copied the test case output from a failed test to help in fixing it:
Testing for -0xb+0xbc+15x
It should work for random inputs too - Expected: 15x+0bcx, instead got: 15x
Thanks, and keep up the great work!
Since you haven't replied i'm assuming for now the description is up to standard :)
if you reread the description :)
Good kata with one very minor issue - the "Angular" constructor is locked, which makes it confusing to try to add a new property (for tracking dependencies). It is easy to workaround but may be worth mentioning in the description.
Loading more items...