1. Using var Instead of let or const
- var leaks scope
- Causes unexpected bugs
- Use const by default
- Use let when value changes
2. Ignoring ===
- == allows type coercion
- "5" == 5 returns true
- Use === for strict comparison
3. Not Understanding async and await
- Promises not awaited
- Code runs out of order
- Always await async calls
- Wrap with try catch
4. Mutating Objects Unknowingly
- Objects pass by reference
- One change affects all
- Use spread operator to copy
- Example:
const newObj = {...obj}5. Forgetting return in Functions
- Function runs
- Returns undefined
- Common in arrow functions with braces
6. Overusing Global Variables
- Hard to debug
- Name collisions
- Use block scope
- Wrap code in functions or modules
7. Not Handling Errors
- App crashes silently
- Poor user experience
- Use try catch
- Handle promise rejections
8. Misusing forEach with async
- forEach ignores await
- Async code fails silently
- Use for...of or Promise.all
9. Manipulating DOM Repeatedly
- Slows page
- Causes reflow
- Cache selectors
- Update DOM in batches
10. Not Learning Event Delegation
- Too many event listeners
- Poor performance
- Attach one listener to parent
- Handle child events using target
Double Tap โฅ๏ธ For More