Ad
  • Default User Avatar

    Hello!

    Kata "task" has no mention of sorting keys:

    If automaton receives an object it will return an array of 3 elements: [n, keys, values] where n is the number of keys, keys is an array of all keys, and values is an array of stringified values. Examples:

    all keys for array with length == 12 is:

    arr = new Array(12).fill('');
    Object.keys(arr);
    // -> ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"]
    

    but if you sort keys array - this will happen:

    arr = new Array(12).fill('');
    Object.keys(arr).sort();
    // -> ["0", "1", "10", "11", "2", "3", "4", "5", "6", "7", "8", "9"]
    

    So, i want to suggest to (1) add a sorting requirements to the description, or (2) fix the tests (something like: sort((a, b) => a < b ? 1 : (a > b ? -1 : 0)) can help (maybe?)).