Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Prateek2111 authored Mar 1, 2024
1 parent 98db701 commit ae914ec
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ const getData = async function(searchValue){

let data = await fetch(`https://api.dictionaryapi.dev/api/v2/entries/en/${searchValue}`);
let response = await data.json();

if(response.title == "No Definitions Found" ){
let div = document.createElement('div');
div.classList.add('detail');
div.innerHTML = `<h2>No word Found</h2>`;
document.querySelector('.text').appendChild(div);
}

console.log(response);
let div = document.createElement('div');
div.classList.add('detail');
Expand All @@ -30,4 +38,4 @@ searchBtn.addEventListener("click" , function(){
}else{
getData(searchValue);
}
})
})

0 comments on commit ae914ec

Please sign in to comment.