I have a spelling game that uses JavaScript.
Currently when the word is spelled correctly it will display a message.
if(++score >= str.length) {
var text = 'Well done! The correct word is ' + str + '!'
drawBackground(background, images.back, text);
}
I would like to display one point for each correct word and increment it. This is what i have tried but no luck
function points() {
var points = 0;
if(++score >= str.length) {
points++;
document.getElementById("points").innerText="Score: " + points;
}
}
The HTML to display the score
<p>Score: <span id="points"></span></p>
. So it'd be "Score: Score: 1".
– phette23 Dec 31 '13 at 20:44