Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
    1. Change digital_root(spezial) to return digital_root(spezial). You need to return the value and you are simply calling the function. Once the function has been called, there is no statement to return and retain the value; therefore "undefined" is returned (default value).
    2. Make sure you put a variable declaration name next to your variable. In your for loop, put var before the variable i. This doesn't effect this code, but makes the variable global which may affect your coding in the future if you don't include it (I've seen bugs before because of the lack of it).
    3. Use markdown to format your code - see here https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code-and-syntax-highlighting.
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I'm quite confused by your comment. You might be using the coding structure wrong? You don't have to implement testcases since the Kata already has inbuilt testcases.

    Mind if you post your code to this reply so I can see what's happening?

  • Custom User Avatar

    I did it in JavaScript. Log is always correct, Default Test passed and Value 0 passed too. Other results are undefined? Tried with assertEquals and assertSimilar. If result is more than one digit I call function digital_root again with new value until single digit. Works well at home but cannot attempt in kata. Why???