My problem: i want to add 1 to a variable (row) within a String.
This won't work:
function checkIfWon(col, row, color) {
alert(document.querySelector('[col="' + col + '"][row="' + row+1 + '"]').getAttribute("color"));
}
Error in Console:
Uncaught TypeError: Cannot read property 'getAttribute' of null
But this code gives me the color:
function checkIfWon(col, row, color) {
let newRow = row+1;
alert(document.querySelector('[col="' + col + '"][row="' + newRow + '"]').getAttribute("color"));
}
so how can i add row + 1 within the String? Thanks.