Ad
  • Custom User Avatar

    don't know what to do with the first basic question
    not correct [], 1 given - Expected: [], instead got: ["foo","bar","foobar","barfoo","foofoo","barbar"]

    why fun(arr, 1) should return an empty array?

    I passed all the test cases, only failed at this one.

    anyone?

  • Custom User Avatar

    That's true. I didn't search for similar task before I publish.
    thx for your feedback

  • Custom User Avatar

    Thanks for your feedback. I'll add expected and return value for failed test cases asap.

    The output ["b", "c", "a", "d", "e"] for arr.move(0,2) seems to be right, not really sure what's the problem here. maybe there's some issue with my test function? I use this function to check if the output array is correct or not.

    function equal(a, b) {
      var i = a.length;
      if (i != b.length) return false;
      while (i--) {
          if (a[i] !== b[i]) return false;
      }
      return true;
    };
    

    use case:

    var arr = ['a', 'b', 'c', 'd', 'e'];
    equal(arr.move(0,2), ["b", "c", "a", "d", "e"]) // should be true