📅  最后修改于: 2022-03-11 14:57:52.997000             🧑  作者: Mango
// GetRandom Words from API and push to Array
async function getRandomWord() {
const res = await fetch('https://random-words-api.vercel.app/word');
const data = await res.json();
return data[Object.keys(data)[0]].word.toLowerCase();
}
getRandomWord();
// Add Word to DOM
async function addWordToDOM() {
randomWord = await getRandomWord();
word.innerHTML = randomWord;
}