Skip to content

Instantly share code, notes, and snippets.

@aalvesjr
Created September 8, 2011 20:20
Show Gist options
  • Save aalvesjr/1204564 to your computer and use it in GitHub Desktop.
Save aalvesjr/1204564 to your computer and use it in GitHub Desktop.
Simulando OO em JS
function showNotice(){
alert(this.level + " : " + this.message);
};
function notice(level,message){
this.level = level;
this.message = message;
this.show = showNotice;
}
var notice01 = new notice("ERRO","Deu Merda...");
var notice02 = new notice("Warning","Vai dar merda...");
var notice03 = new notice("Confirm","Esta certo disso??");
notice01.show();
showNotice.call(notice02);
showNotice.apply(notice03);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment