Debugging Tips
Everyone writes bugs. Being a good developer means being good at finding and fixing them.
Console Tricks
console.log() is your best friend, but there are other methods!
The Debugger Keyword
If you put debugger; in your code, the browser will pause execution at that line (if DevTools is open), allowing you to inspect variables step-by-step.
function trickyLogic(x) {
let y = x * 2;
debugger; // Browser will pause here!
return y + 1;
}
Practice
Challenge 1: Open your browser's Developer Tools (F12 or Right Click -> Inspect), go to the Console tab, and try out console.table.