Skip to content

Instantly share code, notes, and snippets.

@d0rsha
Last active September 6, 2019 11:02
Show Gist options
  • Save d0rsha/5a7c9ce27f7773367ed08a94dac3973f to your computer and use it in GitHub Desktop.
Save d0rsha/5a7c9ce27f7773367ed08a94dac3973f to your computer and use it in GitHub Desktop.
[Console.log] Console.log #JavaScript
// JavaScript debug toolbox
// Measure
console.time() // Starts a timer (can track how long an operation takes)
console.timeEnd() // Stops a timer that was previously started by console.time()
console.count();
let start = performance.now(); // better accuracy
let execTime = start - performance.now(); // than above
// Log to console
console.log('%c Bold With Color');
console.table([foo, bar, baz]); // Cretate table
console.table(['some','array','with','items]);
console.dir();
console.info();
console.warn();
console.error();
// Debug
console.trace();
const deleteMe = () => console.trace('Hoho you found me');
deleteMe();
// https://www.w3schools.com/jsref/obj_console.asp
// Fireship
https://developer.mozilla.org/en-US/docs/Web/API/Console/profile
+ assert() + clear()
+ count() + countReset()
+ dir()
+dirxml()
+error()
+group()
+groupCollapsed()
+groupEnd()
+info()
+log()
+profile()
+profileEnd()
+table()
+time()
+timeEnd()
+timeLog()
+timeStamp()
+trace()
+warn()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment