using console.log javascript code example
Example 1: how to log to the console javascript
console.log('What you want to log here.');
Example 2: 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 3: how to use js console log
console.log('string');
Example 4: js log to console
console.log('this string will show on console')
const strVar1 = 'fizz';
const strVar2 = 'buzz';
console.log('strVar1 is: ' + strVar1 + ' and strVar2 is: ' + strVar2)
console.log(420)
Example 5: how to use console.log javascript
console.log("Hello world!");