diff options
author | IgrisBRC <[email protected]> | 2024-07-15 11:22:02 +0530 |
---|---|---|
committer | IgrisBRC <[email protected]> | 2024-07-15 11:22:02 +0530 |
commit | ff3f02dddcb979da7c5df14ba0279f5968c9e7d8 (patch) | |
tree | d6232df8bc754dc4f12db2a010376a5270ff13ea /public/board.js | |
parent | 57e8e55e1e5d72011971f3010fa2b584d1d8f16d (diff) |
fixed fault functionality, by changing for charAt to charCodeAt
Diffstat (limited to 'public/board.js')
-rw-r--r-- | public/board.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/public/board.js b/public/board.js index bc76394..c5f1fc7 100644 --- a/public/board.js +++ b/public/board.js @@ -15,27 +15,28 @@ function handle_highlight(i) { let id = squares[i].id - let moves = move(board, id.charAt(0), id.charAt(1), to_move) + let moves = move(board, id.charCodeAt(0) - 48, id.charCodeAt(1) - 48, to_move) for (let i = 0; i < previously_highlighted_squares.length; i++) { let prev = document.getElementById(previously_highlighted_squares[i]) prev.classList.remove('highlight') + prev.onclick = null } for (let i = 0; i < moves.length; i++) { let hlsquare = document.getElementById(`${moves[i][0]}${moves[i][1]}`) hlsquare.classList.add('highlight') - hlsquare.onclick = handle_move(hlsquare.id) previously_highlighted_squares.push(`${moves[i][0]}${moves[i][1]}`) } - } -} -function handle_move(id) { - return function() { - console.log(id) } } +//function handle_move(id) { +// return function() { +// console.log(id) +// } +//} +// |