-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
30 lines (23 loc) · 875 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// window.addEventListener('mouseup', selectedWord)
// function selectedWord() {
// let selectedText = window.getSelection()
// console.log(selectedText)
// }
async function fetchData() {
const options = {
method: 'GET',
headers: {
'X-RapidAPI-Key': '7d8216ebb0msh38b7f2a7fe4e9f4p1e8b2ajsn7bc8bf122288',
'X-RapidAPI-Host': 'word-of-the-day2.p.rapidapi.com'
}
};
const record = await fetch('https://word-of-the-day2.p.rapidapi.com/word/today', options)
// .then(response => response.json())
// .then(response => console.log(response))
// .catch(err => console.error(err));
const res = await record.json()
console.log(res)
document.getElementById("def").innerHTML = res[1].word
document.getElementById("mean").innerHTML = res[1].mean
}
fetchData()