Ad
  • Custom User Avatar

    In that line:
    we[i] = (names[i].length + names[i].toLowerCase().split('').map(.........;
    you are modifying the input array we so the program will go on with a bad array we... Bad practice, I told you:-) You should use another array to collect your results.

  • Custom User Avatar

    I don't understand what happened.
    I ran your example with the random tests solution and it gives the result as "William":

    Test.assertEquals(refRandomTestSol("William,Aubrey,Michael", [3,1,6], 2), "Aubrey"); (false result "Aubrey" to see if we get the correct "William")

    returns:
    Failed 1

    Expected: 'Aubrey', instead got: 'William' this shows that the good result is effectively "William" with the refrence solution used by the random tests.

    Maybe you should try again. If you want you can give your solution (mark it with spoiler) and I will try it. 49 guys passed the JS kata. I am afraid your code modify the input. It happens oftn with beginners but it is very bad practice.
    Tell me, please.