🟨 JAVASCRIPT-SPECIFIC GUIDANCE:
- Use Node.js debugger for server-side JS
- Use browser debugger for client-side JS
- Set breakpoints in
.js,.ts,.jsx,.tsxfiles - Use 'pwa-node' debug configuration type
- Check that Node.js is installed
- Async/Await: Be careful with asynchronous code - breakpoints in async functions
- Callbacks: Set breakpoints inside callback functions to debug async operations
- Closures: Watch for variable scope issues in nested functions
- Event Handlers: Debug event-driven code by setting breakpoints in handlers
- Promises: Use breakpoints in
.then()and.catch()blocks
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"program": "${file}",
"console": "integratedTerminal"
}{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
}- Use
console.log(),console.error(),console.table()for quick debugging - Leverage browser developer tools for client-side debugging
- Watch for
undefinedandnullvalues - Be aware of hoisting and variable scope rules
- Use source maps for debugging transpiled code (TypeScript, Babel)