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.
No go.
This kata is about peculiar issue that you may stubmle upon while using JavaScript and I intend it to stay that way.
Should be fine now - I've changed assertEquals to assertSimilar.
When I first published this kata, example tests were not visble at all :)
Your code doesn't solve the main issue:
"The interesting part is that MyClass should only be accessible via the namespace and should not define any extra global variables."
Use Test.assertSimilar instead of Test.assertEquals.
Now that's what I call a challenging kata :)
My solution might not be the most elegant one, but I'm glad I finally managed to handle all corner cases.
https://www.destroyallsoftware.com/talks/wat WATMAN! :D
By looking at the solutions I can tell that lots of people did not understand the point of this kata.
You should avoid adding propeties to 'this' unless you know a function will be attached to an object. Otherwise you're gonna polute global object.
I've added second example.
I hope I'm not spoiling all the fun :)
Why doing an Array.slice in order to count items on page?
Each time you call pageItemCount an array with page slice will be created.
Think of what all objects in javascript have in common.