Created
November 13, 2015 08:00
-
-
Save Serega1288/5351e77b9af632a2883a to your computer and use it in GitHub Desktop.
setTimeout js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***************************/ | |
function explode(){ | |
alert("Boom!"); | |
} | |
setTimeout(explode, 2000); | |
/***************************/ | |
var explode = function(){ | |
alert("Boom!"); | |
}; | |
setTimeout(explode, 2000); | |
/***************************/ | |
setTimeout(function(){ | |
alert("Boom!"); | |
}, 2000); | |
/***************************/ | |
setTimeout("alert('Boom!');", 2000); | |
/***************************/ | |
function greet(greeting){ | |
console.log(greeting); | |
} | |
/***************************/ | |
function getRandom(arr){ | |
return arr[Math.floor(Math.random()*arr.length)]; | |
} | |
/***************************/ | |
var greetings = ["Hello", "Bonjour", "Guten Tag"], | |
randomGreeting = getRandom(greetings); | |
/***************************/ | |
setTimeout(function(){ | |
greet(randomGreeting); | |
}, 1000); | |
/***************************/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment