-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
40 lines (33 loc) · 1.35 KB
/
script.js
File metadata and controls
40 lines (33 loc) · 1.35 KB
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
30
31
32
33
34
35
36
37
38
39
40
function myfunc() {
let x = document.getElementById("form-control").value;
let y = "https://api.dictionaryapi.dev/api/v2/entries/en/" + x;
fetch(y)
.then((response) => {
return response.json();
})
.then((word) => {
console.log(word);
const a = word[0].word;
let p = (document.getElementById("tit").innerHTML = a);
const b = word[0].meanings[0].definitions[0].definition;
let s = (document.getElementById("def").innerHTML = b);
const e = word[0].meanings[0].definitions[0].example;
if (e !== undefined) {
let f = (document.getElementById("pef").innerHTML = e);
} else {
let f = (document.getElementById("pef").innerHTML =
"No Examples Related to this..");
}
const d = word[0].meanings[1].definitions[0].definition;
let o = (document.getElementById("pit").innerHTML = d);
const m = word[0].meanings[1].definitions[0].example;
if (m !== undefined) {
let g = (document.getElementById("lef").innerHTML = m);
} else {
let g = (document.getElementById("lef").innerHTML =
"No Examples Related to this..");
}
const hands1 = document.getElementById('ncwlc').hidden=false;
const hands2 = document.getElementById('ncwc').hidden=false;
});
}