[Go to site: main page, start]

0% found this document useful (0 votes)
9 views1 page

JavaScript Interview Q&A Guide

The document provides a list of common JavaScript interview questions and their answers, covering topics such as variable declarations, hoisting, closures, promises, async/await, and event handling. Key differences between concepts like `==` vs `===`, null vs undefined, and synchronous vs asynchronous execution are also explained. It serves as a quick reference for understanding fundamental JavaScript concepts relevant for interviews.

Uploaded by

snigdhabhoir38
Copyright
© All Rights Reserved
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% found this document useful (0 votes)
9 views1 page

JavaScript Interview Q&A Guide

The document provides a list of common JavaScript interview questions and their answers, covering topics such as variable declarations, hoisting, closures, promises, async/await, and event handling. Key differences between concepts like `==` vs `===`, null vs undefined, and synchronous vs asynchronous execution are also explained. It serves as a quick reference for understanding fundamental JavaScript concepts relevant for interviews.

Uploaded by

snigdhabhoir38
Copyright
© All Rights Reserved
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

JavaScript Interview Questions & Answers

Q: What are var, let, and const?


A: `var` is function-scoped, `let` and `const` are block-scoped. `let` can be reassigned, `const`
cannot.

Q: What is Hoisting?
A: JavaScript moves variable and function declarations to the top of their scope before execution.

Q: Difference between == and ===?


A: `==` compares value only; `===` compares value and type.

Q: What is Closure?
A: A closure is when a function remembers variables from its outer scope even after that scope
has ended.

Q: What is Promise?
A: An object representing the eventual completion or failure of an async operation.

Q: What is async/await?
A: Syntax to handle promises in a cleaner, synchronous-looking way.

Q: What is the Fetch API?


A: Used to make HTTP requests and handle responses using Promises.

Q: What are Arrow Functions?


A: Short syntax for functions: `const sum = (a,b) => a+b;`

Q: What is Destructuring?
A: Extract values from arrays or objects easily: `const {name, age} = user;`

Q: What is Event Bubbling?


A: An event propagates from the inner element to the outer elements in the DOM tree.

Q: What is a Higher Order Function?


A: A function that takes another function as an argument or returns one.

Q: What is NaN?
A: Represents 'Not a Number' but its type is 'number'.

Q: What is the Event Loop?


A: Handles asynchronous operations by moving tasks between call stack and callback queue.

Q: Difference between null and undefined?


A: `undefined` means variable declared but not assigned; `null` means intentional empty value.

Q: What is the difference between synchronous and asynchronous JS?


A: Synchronous executes line-by-line; asynchronous uses callbacks/promises for non-blocking
tasks.

You might also like