Hi, so I want to generate a page that has three random Chuck Norris jokes, I have used the code as per below, however I get the same joke on all three, is there a way to get three random ones and not the same ones and how would I write it to html?
JavaScript:
fetch("http://api.icndb.com/jokes/random/3")
.then(res => res.json())
.then(function(result) {
jokes = result.value[1].joke;
jokes2 = result.value[1].joke;
jokes3 = result.value[1].joke;
console.log(jokes + " " + jokes2 + " " + jokes3);
}),
error => {
console.log(error + "");
};
I created the below on my HTML page;
<div id="jokes" class="container mt-5">
<p id="joke1">Joke 1</p>
<p id="joke2">Joke 2</p>
<p id="joke3">Joke 3</p>
</div>