I have added an event Listener on click event for Html canvas element. The function statements gets executed multiple time. first time the statements execute once, when i call the main fnction again, the click causes same function to execute twice and then thrice and so on
Here is the listener
function initializeNewGame() {
// Set block
cur = new Date();
countDownDate = new Date(cur.getTime() + 5*60010).getTime();
moves = 0;
BLOCK_WIDTH = Math.round(BLOCK_IMG_WIDTH / TOTAL_COLUMNS);
BLOCK_HEIGHT = Math.round(BLOCK_IMG_HEIGHT / TOTAL_ROWS);
document.getElementById("canJigsaw").addEventListener("click", myFunction);
function myFunction() {
moves = moves + 1;
}
SetImageBlock();
DrawGame();
}
addEventListenerbit once and once only