iTranslated by AI
The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
⏱️
JavaScript Console APIs I Always Forget Because They're Rarely Used
console API
| Method | Functionality |
|---|---|
| console.info('<message>', hoge); | Outputs the message and hoge. There are also log, debug, etc. |
| console.error('<message>'); | Outputs the message. Also displays the stack trace. |
| console.trace(); | Displays the stack trace. |
| console.time('<identifier>'); | Measures the time until timeEnd and outputs it at timeEnd. |
| console.timeLog('<identifier>'); | Outputs the intermediate elapsed time. |
| console.timeEnd('<identifier>'); | Same as above. Matches the time call using the identifier. |
console.time() and console.timeEnd() are useful for understanding the current state during performance optimization.
Others
| Method | Functionality |
|---|---|
| debugger; | Sets a breakpoint here. |
Discussion