console in javascript code example
Example 1: how to print to console javascript
console.log("string")
Example 2: javascript log to console
const varName = 'this variable';
console.log(varName);
Example 3: get console javascript
console.stdlog = console.log.bind(console);
console.logs = [];
console.log = function(){
console.logs.push(Array.from(arguments));
console.stdlog.apply(console, arguments);
}
Example 4: what is console in javascript
var str = "Howdy GeeksforGeeks"
var geek = {
book: "harrypotter",
price: "2000"
};
var geek2 = [10, 20, 30];
console.log(str);
console.dir(str);
console.dir(geek);
console.log("geek (log) = ", geek);
console.dir(geek2);
console.log("geek2 (log) = ", geek2);
console.dir("geek2 (dir) = ", geek2);
Example 5: javascript console
console.log('log-message');
console.warn('warn-message');
console.error('error-message');
console.table('table-message');
Example 6: console javascript
console.log(variable)