Created
August 23, 2011 01:20
-
-
Save boton/1164067 to your computer and use it in GitHub Desktop.
#gejs - day04 [exercise 5] - http://gejs.jottit.com/reuni%C3%B3n_4%3A_2011.08.25
This file contains hidden or 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
| var Autobot = function(nombre){ | |
| this.nombre = nombre; | |
| this.timer = +new Date(); | |
| }; | |
| Autobot.prototype.saludar = function() { | |
| alert('Hola, me llamo '+ this.nombre + '\nTime: ' + (+new Date() - this.timer) + 'ms' ); | |
| }; | |
| Autobot.prototype.saludoDelay = function(ms){ | |
| var that = this; | |
| setTimeout(function(){that.saludar();}, ms); | |
| }; | |
| var optimus = new Autobot('Optimus Prime'); | |
| optimus.saludoDelay(100); | |
| optimus.saludoDelay(10000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
estuve probando únicamente en Firefox. Debí dejarme algo para que diera un fallo. Por eso opté por la otra