Last active
September 2, 2016 00:34
-
-
Save ezy/cee8e47b413e0e791742 to your computer and use it in GitHub Desktop.
Useful JS debug console commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.trace('trace var'); // get the trace and your great list of all related functions | |
eg. | |
this.funcY = function(){ | |
this.funcZ(); | |
} | |
this.funcZ = function(){ | |
console.trace('trace car') | |
} | |
} | |
console.table(arr); // display a list of objects as a table | |
debug(var.func); // stops in debug mode when it gets a function call to var.func | |
// Create custom console messages: | |
console.todo = function( msg){ | |
console.log( ‘%c %s %s %s ‘, ‘color: yellow; background-color: black;’, ‘ — ‘, msg, ‘ — ‘); | |
} | |
console.important = function( msg){ | |
console.log( ‘%c%s %s %s’, ‘color: brown; font-weight: bold; text-decoration: underline;’, ‘ — ‘, msg, ‘ — ‘); | |
} | |
console.todo(“This is something that’s need to be fixed”); | |
console.important(‘This is an important message’); | |
montior(func); // in chrome console keep an eye on specific functions | |
$(‘css-selector’) // return the first match of CSS selector | |
$$(‘css-selector’)// return all CSS selectors | |
console.time('timer-name'); // start a timer to measure function performance | |
console.timeEnd('timer-name'); // stop the timer at the end of the function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment