Created
November 11, 2012 21:10
-
-
Save knxroot/4056282 to your computer and use it in GitHub Desktop.
JS_POO Base
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
window.Persona = window.Persona || {}; | |
window.Persona = (function () { | |
"use strict"; | |
function Persona() { | |
} | |
var nombre = ""; | |
Persona.prototype.getNombre = function () { | |
pensar('Entrego mi nombre<br/>'); | |
return this.nombre; | |
}; | |
Persona.prototype.setNombre = function (nombre) { | |
pensar('Cambio mi nombre<br/>'); | |
this.nombre=nombre; | |
}; | |
function pensar(pensamiento){ | |
document.write(pensamiento); | |
} | |
return Persona; | |
}()); | |
var gustavo = new Persona(); | |
gustavo.setNombre("Gustavo"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment