Skip to content

Commit

Permalink
Addressing issue #661 and suggesting a consistency update. (#740)
Browse files Browse the repository at this point in the history
This clears the confusion presented at Issue
[#661](#661 (comment)).
```JavaScript
//line1
guesses.textContent = `${guesses.textContent} ${userGuess}`;
//line2
guesses.textContent += userGuess + ' ';
```
The code below line 1 is presented on the
[tutorial](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/A_first_splash),
and line2 on the [proposed
solution](https://github.com/mdn/learning-area/blob/main/javascript/introduction-to-js-1/first-splash/number-guessing-game.html).
The change made would somewhat clear the confusion.
  • Loading branch information
low-perry authored Aug 27, 2024
1 parent bbe9283 commit ba2ef1d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h1>Number guessing game</h1>
guesses.textContent = 'Previous guesses: ';
}

guesses.textContent += userGuess + ' ';
guesses.textContent = `${guesses.textContent} ${userGuess}`;

if (userGuess === randomNumber) {
lastResult.textContent = 'Congratulations! You got it right!';
Expand Down

0 comments on commit ba2ef1d

Please sign in to comment.