================================== enum and export type difference in TypeScript 😊 ================================== 🔹 enum - Creates a real JavaScript object after compilation. - Exists at runtime. - Generates additional JavaScript code. - The whole enum object is included in the bundle, even if you use only one value. - Can slightly increase bundle size. 🔹 export type - Used only for type checking. - Exists only during development (compile time). - Completely removed after compilation. - Generates no JavaScript output. - Helps reduce bundle size. simple way to say 💡 --------------------- enum → Runtime + JS Object export type → Compile-time only #TypeScript #Frontend #JavaScript #WebDevelopment #Learning #ReactJS #FrontendDevelopment #WebDevelopment #JavaScript #UILogic #FrontendEngineer #SoftwareDevelopment #TechLearning #CodingLife #100DaysOfCode #LinkedInTech 😊
TypeScript enum vs export type
More Relevant Posts
-
The JavaScript "this" Trap 🪤🔥 The Puzzle: What is the output? 🤔 const obj = { name: "JS", getName() { console.log(this.name); } }; const fn = obj.getName; fn(); Output: undefined Why? 🧠 In JavaScript, this depends on HOW a function is called, not where it is written. Lost Context: const fn = obj.getName only copies the function reference. Standalone Call: When you call fn(), there is no object (no dot) before the function. Global Context: It now runs in the Global Context (window object). Since window.name is not "JS", it returns undefined. How to Fix? 🛠️ ✅ Use .bind(): const fn = obj.getName.bind(obj); ✅ Use .call(): fn.call(obj); ✅ Use Arrow Functions: They inherit this from the surrounding scope. Interview Tip: 💡 Always check the "Call Site." No dot before the function call (like fn()) usually means this is lost! #JavaScript #CodingTips #365DaysOfCode #InterviewPrep #WebDev #FullStack #mern #react #node
To view or add a comment, sign in
-
Before jumping into React, developers should understand some fundamental JavaScript concepts. ✅ Closures ✅ Hoisting ✅ Arrow Functions ✅ Destructuring & Array Methods ✅ Spread & Rest Operator ✅ Events ✅ Asynchronous JavaScript ✅ JavaScript Runtime (Call Stack, Event Loop, Web APIs) ✅ ES Modules (import / export) #javascript #reactjs #webdevelopment #frontend #reactdeveloper #asyncjavascript #programming
To view or add a comment, sign in
-
Most JavaScript developers use async features every day — setTimeout, fetch, Promises — but the behavior can still feel confusing until the Event Loop becomes clear. JavaScript runs on a single thread using a Call Stack. When asynchronous operations occur, they are handled by the runtime (browser or Node.js), and their callbacks are placed into a queue. The Event Loop continuously checks: 1️⃣ Is the Call Stack empty? 2️⃣ Is there a callback waiting in the queue? If the stack is empty, the next callback moves into the stack and executes. Example: setTimeout(() => console.log("A"), 0); console.log("B"); Output: B A Even with 0ms, the setTimeout callback runs after the current call stack clears. Understanding this small detail explains a lot of “unexpected” async behavior in JavaScript. Curious to hear from other developers here — What concept made the event loop finally “click” for you? #javascript #webdevelopment #nodejs #eventloop #asyncjavascript #reactjs #softwareengineering
To view or add a comment, sign in
-
JavaScript Module Formats — Why So Many? Ever opened a package and wondered why there are so many build files? index.ts index.js index.cjs index.mjs index.es.js index.umd.js It’s not duplication — it’s compatibility. Each file exists to support a different environment: 🔹 TypeScript for development 🔹 CommonJS for traditional Node.js 🔹 ES Modules for modern bundlers and tree-shaking 🔹 UMD for universal browser + Node usage When building libraries, understanding these formats helps you: - Avoid import/export errors - Support multiple environments - Improve performance with proper tree-shaking - Publish cleaner, production-ready packages Sometimes, growth as a developer isn’t about learning a new framework — it’s about understanding the fundamentals better. What module format do you default to in your projects? #JavaScript #TypeScript #NodeJS #Frontend #Backend #SoftwareEngineering #DevTips
To view or add a comment, sign in
-
-
🚀 JavaScript Reality Frontend JavaScript: Click → UI updates → Everyone happy 😄 Backend JavaScript: Async. Promises. Event loop. Database latency. “Why is this undefined?” 😅 That moment when you realize: JavaScript is single-threaded… But your problems are not. Every backend developer has been confused by async at least once. And that’s when real learning begins. Happy coding 👨💻🔥 #JavaScript #NodeJS #BackendDevelopment #AsyncAwait #EventLoop #Developers #ProgrammingHumor #TechLife
To view or add a comment, sign in
-
-
JavaScript Practice – Reverse a String Today I practiced a simple JavaScript program to reverse a string. Question: Write a function to reverse a string. Code: function reverseString(str){ return str.split("").reverse().join(""); } console.log(reverseString("mary")); Output: yram Explanation: • split("") – Converts the string into an array • reverse() – Reverses the array elements • join("") – Converts the array back into a string I am currently learning Frontend Development and practicing JavaScript programs daily. #javascript #frontenddeveloper #codingpractice #webdevelopment #learning
To view or add a comment, sign in
-
-
🚀 New Blog Alert for JavaScript Developers! Understanding this in JavaScript can feel like magic — until you truly get how call(), apply(), and bind() work. In this article, I break down these powerful concepts with simple explanations and practical examples you can actually use in real projects. 💡 👉 Read here: https://lnkd.in/dzxnYAqM If you’re learning JavaScript or preparing for interviews, this is a must-read! 🔥 Feedback and discussions are welcome 🙌 #JavaScript #WebDevelopment #Frontend #Coding #100DaysOfCode #LearnToCode
To view or add a comment, sign in
-
-
If you truly understand the Event Loop, you understand how JavaScript really works under the hood. Here’s what every developer should know 👇 🧠 Main Thread → Executes synchronous code (Call Stack) 📦 Heap → Stores objects in memory 📋 Event Queue → Holds async callbacks waiting to run ⚙️ Thread Pool (libuv) → Handles heavy I/O tasks 🔁 Event Loop → Continuously checks the stack & queue #EventLoop #JavaScript #NodeJS #AsyncProgramming #BackendDevelopment #FullStackDeveloper #WebDevelopment #CodingInterview #ProgrammingConcepts #TechLearning
To view or add a comment, sign in
-
-
I learned about truthy and falsy values in JavaScript. Non-zero numbers, non-empty strings, arrays, and objects return truthy values. On the other hand, 0, empty strings (""), null, and undefined are falsy. Understanding truthy and falsy behavior helps a lot when working with conditions and logical statements. Strengthening my JavaScript fundamentals step by step. #JavaScript #ProgrammingBasics #WebDevelopment #LearningJourney
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