<h1 class="text">JavaScript setTimeout() Example 1</h1>
<h2 class="text">Wait 3 seconds and a message will appear below</h2>
<p class="text" id="para"></p>
.text {
text-align: center;
}
const para = document.getElementById("para");
function myMessage() {
para.innerHTML = "I just appeared";
console.log("message appeared");
}
setTimeout(myMessage, 3000);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.