Forked from JeremiJohnson/gist:d2bd00aa8f1a79fc0683a76c9744a3b8
Created
March 30, 2022 17:09
-
-
Save ohiosveryown/17932640fc68ae0787ef00893b708c48 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("DOMContentLoaded", () => { | |
fetch("db/jsproject.json") | |
.then((response) => response.json()) | |
.then((data) => { | |
button.addEventListener("click", () => { | |
const answers = data.answers | |
const index = answers[~~(Math.random() * answers.length)] | |
console.log(index) | |
answer.innerText = index | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment