12 Console.xxx You May Not Know
(Source/Credits: https://dev.to/0xkoji/12-console-xxx-you-may-not-know-429a)
I think many of us are using console.log regularly but there is more console. console.tabl...
I think many of us are using console.log regularly but there is more console.
console.table
js
const foo = { id: 1, verified: true, color: 'green' };
const bar = { id: 2, verified: false, color: 'red' };
console.table({ foo, bar})
console.group
js
console.group('User Details');
console.log('name: John Doe');
console.log('job: Software Developer');
// Nested Group
console.group('Address');
console.log('Street: 123 Townsend Street');
console.log('City: San Francisco');
console.log('State: CA');
console.groupEnd();
console.groupEnd();
console.warn
js
console.warn("warning")
console.error
js
console.error("error")
console.info
js
console.info("info")
color tag
js
console.log('%c Auth ',
'color: white; background-color: #2274A5',
'Login page rendered');
console.log('%c GraphQL ',
'color: white; background-color: #95B46A',
'Get user details');
console.log('%c Error ',
'color: white; background-color: #D33F49',
'Error getting user details');
console.time
js
let i = 0;
console.time("While loop");
while (i < 1000000) {
i++;
}
console.timeEnd("While loop");
console.time("For loop");
for (i = 0; i < 1000000; i++) {
// For Loop
}
console.timeEnd("For loop");
Comments section
thewasif
•May 1, 2024
Wow.... That seems very useful. Thank you for awesome knowledge.
jonathanrufino
•May 1, 2024
Interesting list, some of them I didn't know.
You could add images to show the result.
adnaveen
•May 1, 2024
Nice & useful list!
glpzzz
•May 1, 2024
Amazing!!
armshare
•May 1, 2024
Wow Koji ,
Thank you for new knowledge