1.Introduction- Javascript
JavaScript
→ JS is high level , interpreted programming language used for web development.
→ It enables interactive and dynamic content on web pages.
→ JS can run browsers as well as in node.js.
ECMAScript
→ Standard on which JS based
→ Defines core features and syntax of JS
History of JS
→ Created by Brendan Eich in 1995
→ Its previous name was livescript but later renamed as javascript
→ ECMAScript (ES1) was released in 1997 as the first standardization of JavaScript.
→ ECMAScript 5 (ES5) in 2009 introduced many important features like strict mode and JSON support.
→ (ES6/ES2015): A major update added
let
,const
, arrow functions, classes, template literals, and more.JS run time enviroment . How to run JS ?
→ Browser and Node.js
→ A JavaScript Runtime Environment allows JavaScript to execute outside of a browser. Key components include:
JavaScript Engine (e.g., V8 for Chrome, SpiderMonkey for Firefox),
Call Stack (Manages function execution)
Heap Memory (Stores objects and variables)
Event Loop (Handles asynchronous operations)
→ JS can run in console of browser , in node.js , and inside script tag of html file
JAVASCRIPT INTERVIEW QUESTIONS
Question 1. How does JavaScript differ from Java?
Answer . JavaScript is an interpreted language, while Java is compiled.
JavaScript is primarily used for web development, while Java is used in various applications like mobile, web, and enterprise software.
Question 2. What is JS Engine ?
Answer . A JavaScript engine (like V8, SpiderMonkey) is responsible for executing JS code by compiling JS code into machine code .
Question 3 . What are Web Apis in JS ?
Answer . Web APIs (provided by browsers or node.js) allow JavaScript to interact with the DOM, fetch data, and handle events. Examples include setTimeout()
, fetch()
, and localStorage
.