我有一个使用坐标的函数,
我正在寻找一种拥有DRY代码的方式
这是我的代码的一部分: https://codepen.io/sebastiancz/pen/LYGLXjW?editors=1010
一部分是我的代码
const coordinate = {"x": x, "y": y};
this.tilesCoordinates.push(coordinate);
const max = this.tilesCoordinates.length - 1;
const curr = this.tilesCoordinates[max];
const prev = this.tilesCoordinates[max - 1];
....
感谢您的帮助