/ Published in: JavaScript

Basically creates a log function on the window object and uses console.log or alert depending on which is supported. Very basic and simple but definitely useful.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
window.log = function(){ var output = Array.prototype.slice.call(arguments); window.console ? console.log(output) : alert(output); }
Comments
