Ad
  • Custom User Avatar

    Hello,
    My Javascript code is failing for some random tests by the test set up here. However, this this giving correct answer in my personal compueter sublime editor. I am using eval function and for rounding to nearest integer I using Math.round().

    Ex: 586c5 9x7711 885y8 761z3 3b896 87b7 6x98 d86475 100a0 9327a1 9206z3
    Codewar showing : It should work for random inputs too - Expected: -84271, instead got: -80447
    my own test environment showing : Result = -84271

    Is there any idea what am I missing ?

    Sort Update : I was using "localeCompare" function for string compare and now changed to string.prototype.charCodeAt() function for the comparision. BUt nothing changed in codewar. I am still failing here but passing in my own system.

  • Custom User Avatar

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

  • Custom User Avatar

    As my own solution was not working, I unlocked the solution and tested couple of popular solution. However, they are too giving error,

    "No output was produced.
    Make sure tests are written properly using describe and it (required for Node 10)."

    Has anyone successfully completed this kata using Javscript ?

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    I have a question. Would be great if anybody answers. How shall I decide the movement of cursor programmatically ? In the example, I am seeing (for the word 'codewars'),

    c -> a-b-c-OK = 3 (horizontal traverse)
    o => c-d-e-j-o-OK = 5 (first horizontal and then vertical traverse)
    d => o-j-e-d-OK = 4 (reverse vertical traverse)
    .....
    ......
    Hence my question is, how to find the rule for traversing the keyboard layout ? My question is, my code doesn't know which letter is after which letter, in that case how to set up the traversing rule ?

  • Custom User Avatar

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

  • Custom User Avatar

    Could you please say where I get this option ?

  • Custom User Avatar

    Hello ...

    I , by mistake edited the test cases for this Kata now I can't revert it. Is there anyway to bring back the initial set up ?

  • Custom User Avatar

    Thank you for your reply !!! Will cross check my profile setting.

  • Custom User Avatar

    I am learning Javascript and I only chose to develope in JavaScript but can't understand how is this a Javascript class syntax.

    "class Package(object):

    your code here!"

    Can anybody please explain how to read it ?

  • Custom User Avatar

    I also wrote the solution with ternary operators and was really skeptical whether this is the best way and so was seeing the arguments against it. And ya, I think you are right. Clean code looks more elegant than complex, hard-to-read, seemingly-smart-looking-code. I think simple if-else wins here over ternary operator.

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    This solution looks nice but it's not considering two corner cases such as position 0 and position end (arr.length-1) . So this algorithm fails for an example case such as "[20,10,-80,10,10,15,35]" where the answer should be index position "0" but this algorithm gives -1.