JavaScript Execution Contexts: GEC, FEC, and Eval

✅ The 3 Types of Execution Context in JavaScript. 1️⃣ Global Execution Context (GEC) - Created when the JavaScript file first runs. - There is only one global execution context. - It creates: - Global object (window in browser) - this (which refers to window in browser) - Stays in the call stack until program finishes. 2️⃣ Function Execution Context (FEC) - Created every time a function is invoked. - Each function call gets its own execution context. - Pushed to the call stack. - Removed after function finishes. 3️⃣ Eval Execution Context (Rare / Advanced) - Created when code runs inside eval(). - Very rarely used in real production. - Avoided due to security and performance issues. Cheers, Binay 🙏 #javscript #developement #softwareengineering #frontend #buildinpublic #JSInternals #Programming #TechCareers #TechInterview

To view or add a comment, sign in

Explore content categories