diff --git a/myAnswer/index.html b/myAnswer/index.html new file mode 100644 index 0000000..f3a0582 --- /dev/null +++ b/myAnswer/index.html @@ -0,0 +1,25 @@ + + + + + + + + What Would Kanye Do? + + + + + + + +

Kanye Thought of The Day

+ + +

Hi I'm Kanye:

+ +

:

+ + + + \ No newline at end of file diff --git a/myAnswer/js/main.js b/myAnswer/js/main.js new file mode 100644 index 0000000..e471273 --- /dev/null +++ b/myAnswer/js/main.js @@ -0,0 +1,16 @@ +//Example fetch using pokemonapi.co +document.querySelector('button').addEventListener('click', getFetch) + +function getFetch(){ + const url = 'https://api.kanye.rest' + + fetch(url) + .then(res => res.json()) // parse response as JSON + .then(data => { + console.log(data) + document.querySelector('h2').innerText = data.quote + }) + .catch(err => { + console.log(`error ${err}`) + }); +} \ No newline at end of file