Skip to content

Instantly share code, notes, and snippets.

@boton
Created August 23, 2011 01:20
Show Gist options
  • Select an option

  • Save boton/1164067 to your computer and use it in GitHub Desktop.

Select an option

Save boton/1164067 to your computer and use it in GitHub Desktop.
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);
@felixzapata

Copy link
Copy Markdown

estuve probando únicamente en Firefox. Debí dejarme algo para que diera un fallo. Por eso opté por la otra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment