Open ShimSeongbo opened 1 year ago
warn()
error()
time()
timeEnd()
trace()
group()
groupEnd()
tables()
Want to see how much time that piece of code took to run?
console.time("Loop timer") for(i = 0; i < 10000; i++){ // Some code here } console.timeEnd("Loop timer")
Want to see how a function was called?
호출되는 시점의 call stack을 콘솔에 출력하는 메소드
call stack
function trace() { console.trace() } function randomFunction() { trace(); }
If you group console messages, you can make your console easier to read.
console.log("Test1!"); console.group("My message group"); console.log("Test2!"); console.log("Test2!"); console.log("Test2!"); console.groupEnd()
Let’s add tables to visualize data better.
Imagine we have two objects.
var person1 = {name: "Weirdo", age : "-23", hobby: "singing"} var person2 = {name: "SomeName", age : "Infinity", hobby: "programming"}
Simply console.log would make the data look messy.
A table would be better.
console.table({person1, person2})
Try this instead
warn()
error()
time()
/timeEnd()
trace()
group()
/groupEnd()
tables()
Timing operations
Want to see how much time that piece of code took to run?
Tracing how the code got there
Want to see how a function was called?
호출되는 시점의
call stack
을 콘솔에 출력하는 메소드Group console messages
If you group console messages, you can make your console easier to read.
Tables
Let’s add tables to visualize data better.
Imagine we have two objects.
Simply console.log would make the data look messy.
A table would be better.