0% found this document useful (0 votes)
0 views3 pages

JavaScript Interview Questions With Answers

The document provides a summary of key JavaScript interview questions and answers, covering topics such as variable declarations, hoisting, closures, promises, and event handling. It explains the differences between various JavaScript concepts like 'var', 'let', 'const', and the distinctions between 'null' and 'undefined'. Additionally, it addresses advanced topics such as async/await, destructuring, and cloning objects.

Uploaded by

maxsinghparihar
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)
0 views3 pages

JavaScript Interview Questions With Answers

The document provides a summary of key JavaScript interview questions and answers, covering topics such as variable declarations, hoisting, closures, promises, and event handling. It explains the differences between various JavaScript concepts like 'var', 'let', 'const', and the distinctions between 'null' and 'undefined'. Additionally, it addresses advanced topics such as async/await, destructuring, and cloning objects.

Uploaded by

maxsinghparihar
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
You are on page 1/ 3

JavaScript Interview Prep Summary

6. JavaScript Interview Questions with Answers

1. What is JavaScript?

JavaScript is a high-level, interpreted programming language used to create interactive effects within web

browsers.

2. Difference between var, let, and const?

- var: function-scoped, hoisted, can be re-declared and updated.

- let: block-scoped, not hoisted like var, can be updated but not re-declared in the same scope.

- const: block-scoped, cannot be updated or re-declared.

3. What is hoisting?

Hoisting is JavaScript's behavior of moving declarations (variables and functions) to the top of their scope

before execution.

4. What is a closure?

A closure is a function that has access to its own scope, the outer function's scope, and the global scope

even after the outer function has returned.

5. Difference between == and ===?

- == checks for value equality after type coercion.

- === checks for both value and type equality.

6. What is a Promise?

A Promise is an object representing the eventual completion or failure of an asynchronous operation.

7. What is async/await?

async/await is syntax to handle promises more cleanly. `await` pauses execution until the promise resolves,

and `async` marks the function as asynchronous.


JavaScript Interview Prep Summary

8. What is the DOM?

The DOM (Document Object Model) represents the structure of a webpage as a tree of objects, allowing

JavaScript to interact with and manipulate the content and structure.

9. Difference between map, filter, forEach?

- map: transforms each item and returns a new array.

- filter: filters items based on a condition and returns a new array.

- forEach: executes a function for each element but does not return anything.

10. What is event delegation?

Event delegation is a technique where a single event listener is added to a parent element to manage events

for its child elements using event bubbling.

11. What is the difference between null and undefined?

- null: intentional absence of value.

- undefined: variable declared but not assigned any value.

12. What are arrow functions and how are they different?

Arrow functions provide a shorter syntax and do not bind their own `this`, `arguments`, or `super`.

13. How do you clone an object?

Using spread operator: const newObj = { ...oldObj };

14. What is destructuring?

Extracting values from objects or arrays and assigning them to variables.

15. What is the spread operator?

The spread operator (`...`) allows an iterable to be expanded into individual elements.

16. What is event bubbling?

Event bubbling is the process where the event starts from the deepest element and propagates upward
JavaScript Interview Prep Summary

through its ancestors.

17. What is lexical scope?

Lexical scope refers to the ability of a function to access variables from the parent scope in which it was

defined.

18. What is a callback function?

A function passed into another function as an argument, which is then invoked inside the outer function.

19. What is the difference between shallow copy and deep copy?

- Shallow copy copies only the first level.

- Deep copy duplicates nested structures too.

20. What is debouncing?

Debouncing limits the rate at which a function is executed. It waits a certain amount of time before running

again.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy