function moveDown(arr) { for (var i = 0; i < arr.length; i++) { for (var j = 0; j < arr[i].length; j++) { if(arr[i][j].value && j < arr[i].length - 1) { arr[i][j].value = 4; arr[i][j + 1].value = 8; } } } }