print console.log to html code example

Example 1: how to print to console javascript

console.log("string")

Example 2: how to log to the console javascript

console.log('What you want to log here.');

Example 3: 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 4: how to log something in the console. javascript

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

Example 5: how to use console.log javascript

console.log("Hello world!");

Tags: