Skip to content

Instantly share code, notes, and snippets.

@knxroot
Created November 11, 2012 21:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save knxroot/4056282 to your computer and use it in GitHub Desktop.
JS_POO Base
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