Created
June 2, 2014 13:55
-
-
Save essejose/9432d4ae1353040763b3 to your computer and use it in GitHub Desktop.
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
function liga() { | |
this.ligado = true; | |
} | |
Ventilador.prototype.ligar = liga; | |
function Ventilador(velMax) { | |
this.velocidadeMaxima = velMax; | |
this.ligado = false; | |
this.ligar = liga; | |
} | |
var ventilador = new Ventilador(3); | |
alert(ventilador.ligado); // Retorna false | |
ventilador.ligar(); | |
alert(ventilador.ligado); // Retorna true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment