The document outlines key concepts and features of JavaScript, including the differences between loose and strict equality checks, the use of the useEffect hook in React, and the event loop's handling of execution contexts. It also highlights ES6 features such as arrow functions and promises, as well as the concept of hoisting and the scope differences between let, const, and var. Additionally, it explains the temporal dead zone and the role of the microtask queue in the event loop.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views2 pages
Javascript Questions
The document outlines key concepts and features of JavaScript, including the differences between loose and strict equality checks, the use of the useEffect hook in React, and the event loop's handling of execution contexts. It also highlights ES6 features such as arrow functions and promises, as well as the concept of hoisting and the scope differences between let, const, and var. Additionally, it explains the temporal dead zone and the role of the microtask queue in the event loop.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2
Javascript Questions:
JavaScript is a single-threaded (can handle single execution at a time) and
syncronous Basic: Temporal Dead Zone : Variables can’t be accessed until it is initialised. useEffect Hook: used to handle side effects in functional components, (like api calling) useEffect(() => {}, []) vs useEffect(() => {}) => dependency array, in 1st one effect runs only once when the component mounts, 2nd one runs all the time when ever component rerenders. 1.Difference between “==” and “===”? (loose and strict equality check) == -> compares only value, conversion one data type to another and checks === -> compares value as well as type Objects are compared by references not by value (== or ===). Coercion: type conversion 2. Key features for ES6: Arrow functions, Template literals (Backticks), destructuring assignment (extracts values from obj/arr), Promises, enhanced object literals 3.Event Loop: checks if callStack is empty, and then sends the web APIs, and eventHandlers from the Task Queue. MicroTask queue: for promises, then, catch, finally, await functions methods Event loop gives priority to microtask queue. Execution context : When JS engine scans the Js script file, which creates an environment to run code (Memory (variable environment) – where all the variables and functions get memory allocation and code block(Thread of execution) – where code get executed synchronously in a specific order Two phases in EC: Creation Phase(hoisting), Execution Phase(executes JS code in EC) 4. Hoisting: the variable and function declaration are stored in memory for an execution context before we execute our code. 5. Let, Const, Var difference: Let, Const – Block scoped, Var – Function Scoped