Why am I not able to access the meanings API?

24 Views Asked by At

I am trying to access the "meaning" from this API link, but every time it does not return anything? API link:https://api.dictionaryapi.dev/api/v2/entries/en/hello

<div class="word-img"></div>
<button class="word-btn">Click Here</button>

const WORD_URL = "https://api.dictionaryapi.dev/api/v2/entries/en/hello";
const word = document.querySelector(".word-img");
async function addNewWord() {
const promise = await fetch(WORD_URL);
const processedResponse = await promise.json();
let text = document.createElement("h1");

text.innerHTML = processedResponse.meanings.definitions.definition;
text.style.fontSize = "25px";
text.style.color = "blue";
word.appendChild(text);
console.log(text); }

document.querySelector(".word-btn").addEventListener("click", addNewWord);
0

There are 0 best solutions below