// 단어 불러오기
function getWords(){
axios
.get("https://random-word-api.herokuapp.com/word?number=100")
.then(function (response){
response.data.forEach((word) =>{
if (word.length < 10){
words.push(word);
}
});
buttonChange("게임시작");
console.log(words);
// handle success
})
.catch(function (error){
// handle error
console.log(error);
});
}
// 단어 일치 체크
function checkMatch(){
if (wordInput.value.toLowerCase() === wordDisplay.innerText.toLowerCase()){
wordInput.value = "";
if (!isPlaying){
return;
}
score++;
scoreDisplay.innerText = score;
time = GAME_TIME;
const randomIndex = Math.floor(Math.random() * words.length);
wordDisplay.innerText = words[randomIndex];
}
}