
Sometimes you don’t have access to a JavaScript console and need to display console errors some other way. This could be a common case for mobile development. With the below snippet, console errors will appear within alerts real time.
if (typeof console != "undefined") if (typeof console.log != 'undefined') console.olog = console.log; else console.olog = function() {}; console.log = function(message) { console.olog(message); alert(' ' + message + ' '); }; console.error = console.debug = console.info = console.log // Credit: http://stackoverflow.com/a/6604660/3602355