Ad
  • Custom User Avatar

    Issue with your code is not an issue, JS's tests work fine

  • Custom User Avatar

    In JS you copy the outer array then each element (inner array):

    map = map.map(row=>row.slice());
    //Array.prototype.slice copies an entire array
    //Array.prototype.map returns a new array as well so no need to slice the outer array
    
  • Custom User Avatar

    Same problem, I used thingy called "deep copy". It copies from another copy or something like that. In Ruby the syntax is name1 = Marshal.load(Marshal.dump(name2)). Pretty sure there is something like that in JavaScript.

  • Default User Avatar

    I have the same problem,how to solve it?

  • Default User Avatar

    I think good ol' console.log() can help; you with it.
    And making test increasingly difficult, i.e. start with a trivial case then add "more complex test" until you get to the point you want