promise
by John Kiran
HTML
<html>
<body>
<script>
</script>
</body>
</html>
JavaScript
function delay(ms) {
return new Promise(function (resolve) {
setTimeout(resolve, ms)
});
}
delay(3000).then(function () {
alert('runs after 3 seconds');
}
);