Answer the question
In order to leave comments, you need to log in
Why is one of the three associative array values in input displayed incorrectly?
i prints 1 , l prints 7. But o prints o.
Answer the question
In order to leave comments, you need to log in
The error you are asking about is in the equals sign.
if(event.key = a8[event.key]){
- here you simply assign to the event.key
value from a8
. When you enter a small "o"
, zero is returned, and if ()
does not work. In the other two cases, a non-zero is returned, and the code inside the if ()
.
In general, it seems to me that it is necessary not to respond to key events, but to any change in the input field - for example, copied text can be inserted there. And you need to show not a single character, but the entire line.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question