an array gives me different values on a single position when i print it as an array or as an element here's my code :
class tetrispiece {
pezzo;
elm;
dimensioni;
gradi;
posizione;
polygon = [];
//other code and the constructor (tell me if for u is relevant)
updatePolygon (x, y) {
console.log(this.polygon, y)
for (var i = 0; i < this.polygon.length; i++){
console.log(this.polygon[i])
this.polygon[i][0] += x
console.log(this.polygon[i][1], this.polygon)
this.polygon[i][1] += y
console.log(this.polygon[i][1], this.polygon)
}
}
}
pezzoattivo = new tetrispiece(tetris.lastElementChild, pezzi[i], degrees[Math.floor(Math.random()*4)], {left : tetris.lastElementChild.getBoundingClientRect().left, top : 0});
pezzoattivo.updatePolygon(0, 1);