Ad
  • Custom User Avatar

    I'm gonna list only the skip steps, in the middle fill them with a step of 1:
    15350, 15355, 15365, 15375, 15385, 15395, 15500.

    The change is, instead of going from 3 to 4, it changes from 3 to 5, but only when it should be 4. You're thinking it should change 3 for 5.

  • Custom User Avatar

    No, you got it wrong, instead of changing from 3 to 4, it changes from 3 to 5. It means when you see 15350 after 15339 in reality you only travelled 1 mile.

    According to the description the odometer should go from 15229 immediatly to 15500.

    Care to explain how do you think that'll be the case? From 15229, it'll go to 15230, 31, 32, 33, 35 (skipped a 4 here), 36, 37, 38, 39 and 15250.

  • Custom User Avatar

    Have you solved it?I've met the same problem.

  • Default User Avatar

    The CodeWars framework internally uses call so if your implementation isn't correct, nothing will work.

    Note that even if you haven't used console.log, all of the tests log something. It's internally using the same framework.

  • Default User Avatar

    The kata description contains a message saying that console.log internally uses Function.prototype.call, so it looks like log may have been disabled for this kata.

  • Default User Avatar

    You are right!

    The tests doesn't include this variants: my function don't work properly if the second version has more subversion parts than first.

  • Custom User Avatar

    hi, I test with my solution it works for the case mentioned by Anton, but still fails with real test cases. Could you give a hint what could be the difference between the case above and real test case?

  • Custom User Avatar

    Something like that:

    var e = new Event();
    e.subscribe(function () {
      console.log('first');
      e.subscribe(function() {console.log('second'); });
    });
    e.emit(); //first
    e.emit(); //first, second
    

    The idea, that handlers list can be changed during emit, but this handlers should not be called during current emit process, but should be called during next emit process.