Skip to content

Instantly share code, notes, and snippets.

@jnf
Created June 19, 2017 05:14
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 jnf/a1db2a66172a7743a64fd91d9f680d03 to your computer and use it in GitHub Desktop.
Save jnf/a1db2a66172a7743a64fd91d9f680d03 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Timing Test</title>
</head>
<body></body>
<script type="text/javascript">
function sayHello () {
say('Hello!')
}
function sayGoodbye () {
say('Goodbye!')
}
function say (text) {
let h1 = document.createElement('h1')
h1.innerText = text
document.body.appendChild(h1)
}
// setTimeout(sayHello, 3000) // in 3 seconds, say hello
// setInterval(sayGoodbye, 4000) // in 4 seconds, say goodbye
// say('Will I appear before or after Hello and Goodbye?')
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment