🔥 var vs let vs const (JavaScript) tips! 🔹 var → Function scoped, re-declare & update possible 🔹 let → Block scoped, update possible 🔹 const → Block scoped, update not possible 💡 Best Practice: Use const by default, let when needed. Avoid var. #JavaScript #WebDevelopment #CodingJourney Sulayman Ahmed Khan
JavaScript var vs let vs const: Best Practices
More Relevant Posts
-
In JavaScript, == and === are both comparison operators — but they behave differently. == → Compares values === → Compares both value and type Example: 5 == "5" → true 5 === "5" → false For cleaner and more predictable code, always prefer === ✅ #JavaScript #WebDevelopment #CodingTips
To view or add a comment, sign in
-
-
Got a minute for some JavaScript? 📏 What do you know about the length property of functions? Answers 🔍 >>> 3 1 1 You can remember it this way: The length property of a function equals the number of parameters before the first parameter with a default value. #javascript #webdevelopment
To view or add a comment, sign in
-
-
Got a minute for some JavaScript? 🍒 What does this code output? Answers 🔍 >>> - "Tom says meow" - TypeError: c.createKitten is not a function - "Kitty says meow" Why the TypeError? *createKitten* is a static method - it lives on the *Cat* constructor, not on instances. *c* is an instance, so it cannot access static methods. Only *Cat.createKitten()* works. #javascript #webdevelopment
To view or add a comment, sign in
-
-
https://lnkd.in/dgECwK-b Day 57/100 🚀 Refactored my AttendTrack project — improved the layout, fixed the counting functionality, and converted it into a PWA so it can work offline. #100DaysOfCode #JavaScript #WebDev
To view or add a comment, sign in
-
⚡ JavaScript Performance Tip: Debounce vs Throttle Debounce → Runs after the delay Throttle → Runs every fixed interval #javascript #frontenddevelopment #reactjs #webperformance #webdevelopment
To view or add a comment, sign in
-
-
Day 86 / 365 👨💻 Light practice focused on strengthening basics. 🧩 Revisited React component structure ⚙️ Practiced small state updates with useState 🔁 Observed re-render behavior in simple examples 🧠 Focused on keeping logic clear and predictable #365DaysOfCode #React #JavaScript #Frontend
To view or add a comment, sign in
-
Today I practiced a small JavaScript program to change the background color when a button is clicked. When the button is pressed, JavaScript triggers a function that changes the page’s background color using DOM manipulation. This helped me understand: ✔ Event handling ✔ onclick function ✔ DOM manipulation ✔ How JavaScript interacts with HTML & CSS Small practice, better understanding 🚀 #JavaScript #WebDevelopment #Frontend #CodingPractice #LearningJourney
To view or add a comment, sign in
-
Got a minute for some JavaScript? 🍵 What does this code output? Answers 🔍 >>> - ReferenceError: message is not defined Why? Because let lives only inside the block where it’s created. In this code, message is created inside the *if {}* and *else {}* blocks. When JavaScript reaches *console.log(message)*, it is already outside those blocks, so the variable no longer exists. #javascript #webdevelopment
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development