Created
September 8, 2011 20:20
-
-
Save aalvesjr/1204564 to your computer and use it in GitHub Desktop.
Simulando OO em JS
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
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