Javascript Pro Tips - Console Log

Javascript Pro Tips

Wed, 17 Oct 2018
// Computed Property Names

const foo = { name: 'tom',   age: 30, nervous: false };
const bar = { name: 'dick',  age: 40, nervous: false };
const baz = { name: 'harry', age: 50, nervous: true };

console.log('%c My Friends', 'color: orange; font-weight: bold;' )
console.log({ foo, bar, baz });

color

// Table

console.table([foo, bar, baz])

table

// Console.time

console.time('looper')

let i = 0;
while (i < 1000000) { i ++ }

console.timeEnd('looper')

looper

// Stack Trace Logs

const deleteMe = () => console.trace('bye bye database')

deleteMe()
deleteMe()

stacktrace

Source https://github.com/codediodeio/code-this-not-that-js

Loading...
Samson Lam

Samson Lam Microsoft Student Partner | Programmer | Change Agent | Fintech Innovation Partner