Last active
March 6, 2017 16:42
-
-
Save oliverpool/7572854d389935100a11dce4d342501d to your computer and use it in GitHub Desktop.
Display console.log output (useful on jsfiddle for instance)
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 newLog(oldLog) { | |
return function() { | |
var args = Array.prototype.slice.call(arguments, 0); | |
document.getElementById('console-log').innerText += args.join(" ") + "\n"; | |
oldLog.apply(this, args) | |
} | |
} | |
console.log = newLog(console.log) | |
console.error = newLog(console.error) |
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
<p id="console-log" style="font-family: monospace;"></p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: http://jsfiddle.net/wdgfnn0h/4/