Skip to content

Commit 750eb80

Browse files
committed
fix to battleship, adding back in firstChar with var declaration
1 parent 4b69dad commit 750eb80

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

chapter8/battleship.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ function parseGuess(guess) {
147147
if (guess === null || guess.length !== 2) {
148148
alert("Oops, please enter a letter and a number on the board.");
149149
} else {
150-
var row = alphabet.indexOf(guess.charAt(0));
150+
var firstChar = guess.charAt(0);
151+
var row = alphabet.indexOf(firstChar);
151152
var column = guess.charAt(1);
152153

153154
if (isNaN(row) || isNaN(column)) {

0 commit comments

Comments
 (0)