Skip to content

Instantly share code, notes, and snippets.

@herrera-ignacio
Created February 10, 2020 22:36
Show Gist options
  • Save herrera-ignacio/a6a02caec448417f3eb456adf2058445 to your computer and use it in GitHub Desktop.
Save herrera-ignacio/a6a02caec448417f3eb456adf2058445 to your computer and use it in GitHub Desktop.
The power of JavaScript console!
// Correct usage of console.log
const foo = { name: 'Nacho', age: 25, role: 'Fullstack' }
const bar = { name: 'Rama', age: 26, role: 'Frontend' }
const baz = { name: 'Tito', age: 27, role: 'Frontend'
const logIt = () => console.log({ foo, bar, baz });
// Custom CSS
console.log('%c My Friends', 'color: orange; font-weight: bold;' )
logIt();
// Tables!
console.table([foo, bar, baz]);
// Benchmarking
console.time('looper')
let i = 0;
while (i < 100000) { i ++ }
console.timeEnd('looper') // ms
// Stack Trace Logs
const deleteMe = () => console.trace('bye bye database');
deleteMe();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment