What is JavaScript
JavaScript (JS) is a programming language used to make websites interactive and dynamic.(e.g., having complex animations, clickable buttons, popup menus, etc.).
If HTML is the structure of a website and CSS is the design, then JavaScript is the brain that adds behavior.
Founder of JavaScript
JavaScript was created by Brendan Eich.
Created at: Netscape
Year: 1995
Developed in: Just 10 days!
Original name: Mocha
Later renamed to: LiveScript
Finally renamed to: JavaScript
Why JavaScript is called JavaScript
JavaScript was originally called LiveScript. In 1995, it was renamed to JavaScript as a marketing strategy to take advantage of Java’s popularity, even though the two languages are entirely different in design and functionality.
How JavaScript Code Runs in the Browser
JavaScript runs inside the browser’s JavaScript engine (like V8 in Chrome). The engine first parses the code, then uses Just-In-Time (JIT) compilation to convert it into machine code, which is executed by the CPU.
Simple Flow Diagram
Our Code
⬇
JavaScript Engine (V8) (inside our browser)
⬇
Machine Code (0s & 1s)
⬇
CPU Executes
⬇
Output
Is JavaScript compiled or interpreted?
JavaScript was traditionally considered an interpreted language, but modern engines like V8 use Just-In-Time (JIT) compilation. So it is technically both compiled and interpreted.
Just-In-Time (JIT)
Just-In-Time (JIT) compilation is a technique used by modern JavaScript engines (like Google Chrome's V8 and Firefox's SpiderMonkey) to improve performance by dynamically compiling JavaScript code into native, optimized machine code during execution, rather than interpreting it line by line every time.
Conclusion
JavaScript is a powerful language that plays a major role in modern web development. Understanding how it works inside the browser helps developers write efficient and optimized code.
Top comments (0)