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.
To write tests for your code you first need to refactor it into smaller test-able units. The existing function in your code contains user-interaction (alert(), prompt(), ...) which makes it impossible to test using a unit-test framework like codewars provides.
I have done some refactoring and uploaded them as fork -> https://www.codewars.com/kumite/604243f85a72ae000d16e0bf?sel=60434735db87fd000c194e99
I extracted functions for
... and also started to write some tests for the first function.
I decided not to use the internal test framework from codewars but chose to use "Mocha BDD" instead (you can simply select it in your Kumite/Kata when designing a new one). I think it is more useful to learn how to use real-world test-frameworks when starting to learn about unit-tests. Mocha is often used in combination with an assertion framework - I have used "chai" in my case. You can find information about how both frameworks work and what they do here:
https://mochajs.org/#getting-started
https://mochajs.org/#interfaces
https://www.chaijs.com/guide/styles/#assert
Maybe it helps you as a starting point on how to write tests for your code ... and also on how to create Kumites/Katas for Codewars :)
Yep - it is confusing that the introduction says one should round down to the NEAREST integer - because the nearest integer of 25.6 is 26 which could only be achieved by rounding up ^^