Ad
  • Default User Avatar

    729 (9^3) and 216 (6^3) are both cubes. You're supposed to return the number of lucky sevens so 2 is correct.

  • Default User Avatar

    As it is, you can return another function and that function can be as long as it wants.

  • Default User Avatar

    If you're talking about this test case → rank("Elijah,Chloe,Elizabeth,Matthew,Natalie,Jayden", [1, 3, 5, 5, 3, 6], 2), "Matthew")

    Elizabeth is indeed before Matthew but the test asks for the one in 2nd place. Hence, Matthew is the correct answer.

  • Default User Avatar

    You're right E comes before I. Here are the results of the test case you provided, sorted →

    [ 'Michael', 348 ] [ 'Robert', 336 ] [ 'Ethan', 318 ] [ 'Lily', 310 ] [ 'Benjamin', 304 ] [ 'Emily', 207 ] [ 'Isabella', 207 ] [ 'Aiden', 190 ] [ 'Logan', 162 ] ....

    Isabella is the one in 7th place so the test works just fine.
    Maybe you got something else wrong.

  • Default User Avatar

    Are you sure you're looking at score points and not Honor? You can't see your score points on your profile, you can check your score in the API here.

  • 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

    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

    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.

  • Default User Avatar

    If you log your deWUBed variable you'll see where the issue with the extra spaces is.
    As far as the different result in console vs return statement, I just tried it and it seems to be an issue with Node 10. Or at least I think so. If you change it to Node 8 you'll see they both return the same thing.

  • Default User Avatar

    You probably shouldn't use NULL as you basically have a char. You could instead use a simple ' ', so text[c] = ' '; should work for you.

    I should also note, you're not checking whether you need to capitalize the first letter so you might wanna re-think your code a bit.