Inspiration
MLH Team
What it does
It generating a random word and giving a definition of that particular generating word.
How we built it
We are using 2 APIs here 1 - https://random-word-api.herokuapp.com/home 2- https://dictionaryapi.com/ and connect both the APIs. We have one button and when we clicking it , its giving us a random word and then definition of that particular word. We are making two functions one for randomWord and one for randomDefintion and we are fetching the apis and storing the response in json format.
const randomWord = () =>{
fetch('https://random-word-api.herokuapp.com//word?number=1')
.then(response => {
return response.json();
})
.then(response =>{
word.textContent = response;
body.appendChild(word);
randomDefinition(word);
})
.catch(err =>{
console.log(err);
})
}
Same we will make randomDefiniton function and call it in the randomWord function.
button.addEventListener('click', function(){
randomWord();
})
At last , we will add an event listener to a button and when we click , it will call randomWord function
Challenges we ran into
Accomplishments that we're proud of
We able to connect the two APIs successfully
What we learned
Connecting two different APIs
What's next for Connect Two APIs
We can improve the UI.
Log in or sign up for Devpost to join the conversation.