Ad
  • Custom User Avatar

    Thanks Balkoth, my mistake!

  • Custom User Avatar

    Guess I should report this problem even though it really doesn't affect anything else.

    On the kata page, I selected the following options:

    • Sort by: Latest
    • Language: My Languages
    • Status: Approved
    • Progress: Kata I have not completed

    The problem is the list of kata I get from that includes a few dozen kata that I have already completed.

  • Default User Avatar

    Well, technically, ["Bob"] and ["Bob"] are two different objects, so they're not equal.

    To compare arrays or objects, you should use Test.assertSimilar instead of Test.assertEquals.

  • Custom User Avatar

    The testing framework seems to be buggy - go to Kata http://www.codewars.com/kata/5356ad2cbb858025d800111d/train/javascript

    With my solution, I get the following error:

    Expected: ["Bob"], instead got: ["Bob"]

    ...obviously, these are the same, so it should have passed! Below is my solution and test data (spoiler alert):

    Solution:

    function capMe(names) {
    var capitalised = [], newName;
    for (var i = 0; i<names.length; i++) {
    newName = names[i].toLowerCase();
    newName = newName.charAt(0).toUpperCase() + newName.slice(1);
    capitalised.push(newName);
    }
    return capitalised;
    }

    TEST CASES:

    var test = ['bob'];
    Test.assertEquals(capMe(test), ['Bob']);
    test = ['bob', 'james', 'CHRIS'];
    Test.assertEquals(capMe(test), ['Bob', 'James', 'Chris']);