Created
June 5, 2014 11:16
-
-
Save marabesi/d1ba13e832ce53e8ac73 to your computer and use it in GitHub Desktop.
Understanding the language with objects and prototype
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 DebugConsole() { | |
var consoleElem = document.createElement('div'); | |
consoleElem.id = "debug"; | |
document.body.appendChild(consoleElem); | |
this.shaded = false; | |
} | |
DebugConsole.prototype.displayMsg = function(msg) { | |
var msgElement = document.createElement('div'); | |
msgElement.appendChild(document.createTextNode(msg)); | |
msgElement.className = 'text-log'; | |
var consoleElement = document.getElementById('debug'); | |
consoleElement.appendChild(msgElement); | |
this.shaded = !this.shaded; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment