Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohiosveryown/17932640fc68ae0787ef00893b708c48 to your computer and use it in GitHub Desktop.
Save ohiosveryown/17932640fc68ae0787ef00893b708c48 to your computer and use it in GitHub Desktop.
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