I have made a button:
<input type="button" value="a" onclick="searchLetter(this)"></input>
When clicked, it is supposed to call on a function which checks if the letter is in the word and if it is, add it to the spaces array in the corresponding spot:
function searchLetter(obj)
{
var letter = obj.value;
obj.disable;
for (i = 0; i <= word.length; i++){
if (word[i] == letter) {
wordSpaces[i] = letter;
document.getElementById('spaces').innerHTML = wordSpaces.join('');
break;
}
}
}
However, the button is not calling on it and I am not sure why.
wordis undefined