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.
So I just took this from the For Example box within the instructions:
For example:
var c = new Counter();
c.incr(); // counter is now at 1
c + 1; // 2
c > 1; // false
c > 0; // true
c == 1; // true
Math.sqrt(c); // 1
Interpreted each line as a literal unit test as follows:
var c = new Counter();
Test.assertEquals(c.incr(), 1) // counter is now at 1
Test.assertEquals(c + 1, 2); // 2
Test.assertEquals(c > 1, false); // false
Test.assertEquals(c > 0, true); // true
Test.assertEquals(c == 1, true); // true
Test.assertEquals(Math.sqrt(c), 1); // 1
yields the following results:
Expected: 1, instead got: undefined
0 Passed
1 Failed
0 Errors
Process took 49ms to complete
Changing the line as mentioned to what was outlined earlier yeilds:
Test Passed: Value == 1
Test Passed: Value == 2
Test Passed: Value == false
Test Passed: Value == true
Test Passed: Value == true
Test Passed: Value == 1
6 Passed
0 Failed
0 Errors
Process took 52ms to complete
Ok, so try running the following Unit Test:
var c = new Counter();
Test.assertEquals(c.incr(), 1) // counter is now at 1
/**
Runs in console:
Expected: 1, instead got: undefined
0 Passed
1 Failed
0 Errors
Process took 47ms to complete
*/
This comment is hidden because it contains spoiler information about the solution