clavier bangarang
This commit is contained in:
parent
5a5d4f5924
commit
7006d4657d
1 changed files with 18 additions and 1 deletions
19
script.js
19
script.js
|
@ -8,6 +8,7 @@ let arrWords;
|
|||
readTextFile("words.txt");
|
||||
|
||||
aleatoire();
|
||||
setMyKeyDownListener();
|
||||
|
||||
function change_color_good_letter(coord){
|
||||
coord = "case".concat(coord)
|
||||
|
@ -125,4 +126,20 @@ function aleatoire() {
|
|||
let rand = Math.floor(Math.random() * arrWords.length);
|
||||
reponse = arrWords[rand];
|
||||
console.log(reponse);
|
||||
}
|
||||
}
|
||||
|
||||
function setMyKeyDownListener() {
|
||||
window.addEventListener("keydown",
|
||||
function(event){
|
||||
console.log(event.key)
|
||||
if (event.key == "Enter"){
|
||||
Enter();
|
||||
}
|
||||
else if (event.key == "Backspace") {
|
||||
Supprimer();
|
||||
}
|
||||
else if (event.key != "Control" & event.key != "Fn" & event.key != "Alt" & event.key != "Tab" & event.key != "CapsLock"){
|
||||
update(event.key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue