Ad
  • Custom User Avatar

    Thank you very much!

  • Custom User Avatar

    Add console.log(x); inside your function, make it the first line. See the output panel, the last line you see there is the input that makes your code fail. Once you know which input makes your code fail, you can analyze where in your code you're making a mistake.

     assert.strictEqual(high('aa b'), 'aa');
    

    It's failing that one for instance.

  • Custom User Avatar

    Sorry, but it seems I don't understand what you're talking about. (I'm very new to programming). I debug code by running it in VSC and looking in the terminal to see what different sections of code return. At the end of the story, I run the resulting function, offering it various variables (including from sample tests from the author of kata at CodeWars).

    Please explain, what do you mean by "printing the input".

  • Custom User Avatar

    To debug your code. See what the input is, and then you can try the same input in VSC.

  • Custom User Avatar

    Start by printing the input.

  • Custom User Avatar

    When testing code on CodeWars I get: "TypeError: Cannot read property '0' of undefined". At the same time, VSC does not see errors in my code and testing the function on various strings, I get the correct result.

    How could I figure out what the test swears at?

  • Custom User Avatar

    nvm

  • Custom User Avatar

    in other words i have a problem with: "If two words score the same, return the word that appears earliest in the original string." I would be glad if someone would help me with implementation that functionality in my code

  • Custom User Avatar

    I'm looking for help (Python). I manage to create dictionary with key(first word) : value(of a word) but when the test is "aa b" and im looping through dict to find the highest value it points to second key for no reason. How do I pull the first key if values of the keys are the same?