Ad
  • Custom User Avatar

    I'm in love with this kata's description.
    I found it very creative and helpful, but with a thorough and kind description like this, it would be great to have more diverse tests cases to pass so it becomes a bit more complex and challenging.

  • Custom User Avatar

    Objects, as opposed to primitives, are passed by reference in JavaScript. That means you can modify them. You shouldn't. You should return a new object. (Generally.)

  • Default User Avatar

    Thank you for your feedback, this is very obviously my first time:) Will add some random testing! What do you mean with modyfying the input argument?

  • Custom User Avatar

    No random tests.

    Also, modifying the input argument as the example solution does is not a best practice.

  • Default User Avatar

    Thank you! I realised this error soon after I posted, sorry for stupid question:)

  • Custom User Avatar

    Make sure you're returning the value instead of printing it to the console using console.log. Returning the value actually modifies the variable and therefore allows it to be checked for equality. Undefined is the default value when nothing is returned.

  • Default User Avatar

    Hi, Im totally new to this, and I don't really understand what I'm doing wrong. I keep getting this message "Test Results:
    Log
    5050
    ✘ Expected: 5050, instead got: undefined"

    I do get 5050, tried the code in another console too and it worked fine. So do anyone have any idea why it doesnt work here?