Ad
  • Custom User Avatar
  • Custom User Avatar

    I tested your code and realized that if you change just one line of code a little bit, you will pass this kata.

    Now in your code you check that if the number of vowels is less than the length of the word to return "Invalid word",
    but in this case you need to check that the number of vowels is greater than or equal to the number of consonants.

    if number_of_vowels >= number_of_consonant // should return Invalid word
    
  • Custom User Avatar

    There is an error in your code in checking the vowel letters.

    1. The number of vowels should not be greater than or equal to the number of consonants
  • Default User Avatar

    Nope, it's not in the glovebox, he's getting one to put in there

  • Custom User Avatar

    Not a kata issue, it's a literal quote.

  • Default User Avatar

    This allows multiple Spaces to be replaced with one

    return convertToString.replace(/\s+/g,' ');

  • Custom User Avatar

    No, natan is right, you're mutating the input value in your code. It should be fixed (now the expected value is calculated before your function is called). Try again.

  • Default User Avatar

    The extras are probably coming from that you .. put it there. push

  • Custom User Avatar

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

  • Default User Avatar

    Please put

    ```javascript

    above your code and

    ```

    after it (on its own line, check preview to make sure you got it right)

    Your code currently reads: if the change is less than 20: throw up.
    Try my proposed description instead? (right above this thread)

  • Default User Avatar

    Actually upon further inspection I was slightly wrong here. I'm not sure exactly what the issue is, but it seems like in Node 10, it stops logging on the first test you fail, whereas in other Node versions it keeps running and logging every failed test. Node 10 log, Node 8 log. Combine that with return on Node 10 also only showing the test failed and nothing before it like so, I think me and OP got confused looking at images #1 and #3, thinking there's an inconsistency between log and return.

    Then again if I had just paid attention to the description I would've noticed its logging different test cases ('WUB should be ...' vs 'multiple WUB should..'). So yeah, sorry my bad. I guess I saw what I was conditioned to see. In hindsight, just logging the input would've made everything clear instantly, silly mistake.

    It's still kind of an issue though is it not? What if I wanna log every input even if I pass the test, so that I can make some deduction about what my potential error is in the rest of the cases. Maybe it's one of those mystery katas. Very minor issue but w/e.

    Sorry if I seemed a little aggressive, I should've paid closer attention.

  • Default User Avatar

    Yeah, I misread something earlier, no offense. But please just tell me which tools did not work?

  • Default User Avatar

    That's basically exactly what I said.

    Printing it does nothing to pass a tests on Codewars, regardless of Node.

    That's not the point. They were comparing their conflicting output between console.log and return. Regardless of whether there's a bug with Node or not, you should be able to trust your tools to do their job consistently. In this case they didn't. That's all. Nobody said they had to print instead of returning. In fact →

    I'd also like to point out that your code, after you fix it, should work just fine in Node 10. It's only the console.log that's apparently trimming some spaces.

    Quick on the trigger there bud.

  • Default User Avatar

    What bug? You need to return the value itself. Printing it does nothing to pass a tests on Codewars, regardless of Node. You get three spaces beteween letters for the second test because there are multiple consecutive 'WUB's in that test string. The first test only has one 'WUB' between letters. So, your code is not finished because it does not account for multiples.

  • Default User Avatar

    No, I wouldn't say that. Not that I know what I'm talking about, but generally I'd say go with the latest one, that's where all the juicy stuff are.

    Maybe that was a bug back in Node 10, maybe it's just the Codewars editor on Node 10, I don't really know. It seems to work just fine on my IDE, so if it was a bug, it's certainly fixed in the lastest version.

    I'd also like to point out that your code, after you fix it, should work just fine in Node 10. It's only the console.log that's apparently trimming some spaces.

  • Loading more items...