Most developers know var is bad… Yet it’s still showing up in codebases in 2026 😬 Here’s why it keeps breaking things 👇 🔴 var is function-scoped, hoisted, and re-declarable → Leads to silent, hard-to-trace bugs 🟢 const is block-scoped and strict → Fails fast, catches mistakes early, keeps your code predictable 💡 The rule is simple: → const by default — always → let when reassignment is needed → var — never again ⚡ Quick 5-second fix: Add "no-var": "error" to your ESLint config and enforce it across your team 👀 Still seeing var in your codebase? Drop a 😅 — you’re definitely not alone ♻️ Repost this to save your team hours of debugging 👉 Follow Mohd Sharfuddin Khan for daily JavaScript tips that actually level up your coding #JavaScript #WebDevelopment #Frontend #CodingTips #CleanCode #Developers #ESLint #JSDaily #WebDevelopment #FrontendDeveloper #100DaysOfCode #CodeTips #LearnToCode #ProgrammingTips #TechCommunity #DevLife
Rule n°1 : use linter
From my point of view the idea about const much-dipper. Javascript is multiparadigm programming language, so it allows you to write code in any paradigm what you want - oop, functional, procedural. Const is idea from functional programming where you during program execution cannot change value of variable. You only can create a new based on it. Keeping variables immutable help you prevent popular Javascript execution errors, but it also requires from you more control over your code. In two words, it difficult for understanding concept, and because of it much easier just to say - do not use vars, use consts.