Skip to content

Instantly share code, notes, and snippets.

@cabreraalex
Created September 25, 2019 15:54
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 cabreraalex/1c24e8fa5192ae6f27fdb37896b9d781 to your computer and use it in GitHub Desktop.
Save cabreraalex/1c24e8fa5192ae6f27fdb37896b9d781 to your computer and use it in GitHub Desktop.
<script>
let rand = -1;
function getRand() {
fetch("./rand")
.then(d => d.text())
.then(d => (rand = d));
}
</script>
<h1>Your number is {rand}!</h1>
<button on:click={getRand}>Get a random number</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment