console log html element code example

Example 1: display console log in HTML

(function () {
    var old = console.log;
    var logger = document.getElementById('log');
    console.log = function (message) {
        if (typeof message == 'object') {
            logger.innerHTML += (JSON && JSON.stringify ? JSON.stringify(message) : message) + '<br />';
        } else {
            logger.innerHTML += message + '<br />';
        }
    }
})();

Example 2: how to use js console log

console.log('string');

Example 3: how to log something in the console. javascript

console.log('https://discord.gg/5yjWgMS');

Tags:

Java Example