Created
October 19, 2012 15:06
-
-
Save vivekrk/3918717 to your computer and use it in GitHub Desktop.
A simple timer sample in javascript
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 Timer () { | |
var i = 1; | |
var timer = setInterval(function() { | |
console.log(i); | |
i++; | |
if(i > 10) { | |
clearInterval(timer); | |
} | |
}, 1000); | |
} | |
var timer = new Timer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment