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

Javascripts Questions

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)
5 views3 pages

Javascripts Questions

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 Questions

Q9. What is the difference between var, let, and const?


A:

 var – function-scoped, can be redeclared.


 let – block-scoped, can be reassigned but not redeclared.
 const – block-scoped, cannot be reassigned.

Q10. What is the difference between == and === in JavaScript?


A: == checks value with type conversion, === checks value and type without conversion.

Q11. Explain event bubbling and event capturing.


A:

 Bubbling – event starts from the target element and bubbles up to the root.
 Capturing – event starts from the root and goes down to the target.

Q12. What is the difference between synchronous and asynchronous JavaScript?


A: Synchronous runs tasks one after another, blocking execution. Asynchronous allows tasks to
run in the background without blocking, using callbacks, promises, or async/await.

Q13. What is the difference between null and undefined?


A:

 null – intentional empty value.


 undefined – variable declared but not assigned a value.

Q14. What is a closure in JavaScript?


A: A closure is when a function remembers and accesses variables from its outer scope even
after that scope has closed.

What is JavaScript?
A scripting language used to create interactive web pages.

36. Difference between var, let, and const?


Var – function scope; Let – block scope; Const – block scope, constant value.

37. Difference between == and ===?


== compares value only, === compares value and type.

38. What is a closure?


A function that remembers variables from its outer scope.

39. What is event delegation?


Using a single listener on a parent to handle events from children.
40. Difference between synchronous and asynchronous JS?
Synchronous – tasks run in order; Asynchronous – tasks run without blocking.

41. What are callbacks?


Functions passed as arguments to be executed later.

42. Difference between null and undefined?


Null – intentional empty value; Undefined – variable not assigned.

43. What is an arrow function?


Shorter syntax for functions, inherits this from scope.

44. What is the difference between map() and forEach()?


map returns a new array; forEach does not.

45. What is the difference between localStorage and sessionStorage?


LocalStorage – persists data until cleared; SessionStorage – clears on tab close.

46. What is the DOM?


Document Object Model – structure of HTML elements accessible via JavaScript.

47. What is the difference between async/await and Promises?


Async/await is cleaner syntax for handling promises.

48. What is debouncing?


Delaying function execution until after a certain time has passed.

49. What is throttling?


Limiting the execution of a function to a fixed rate.

50. What is hoisting?


JavaScript moves function and variable declarations to the top before execution.

51. What is the difference between this in arrow functions and normal functions?
Arrow functions inherit this from the surrounding scope; normal functions bind this at call
time.

52. What is JSON and how is it used?


JavaScript Object Notation – lightweight data format used for API

JavaScript – Frequently Asked Interview Q&A


1. What is JavaScript?
A scripting language for interactive and dynamic web pages.
2. Difference between var, let, and const?
var: function scope, let: block scope, const: block scope + constant.

3. Difference between == and ===?


== compares values, === compares value and type.

4. What is a closure?
Function that remembers variables from its outer scope even after scope ends.

5. What is event delegation?


Handling events at a parent level for multiple child elements.

6. Difference between synchronous and asynchronous JS?


Synchronous: one task at a time, Asynchronous: tasks can run in background.

7. What are callbacks?


Functions passed as arguments to be executed later.

8. Difference between null and undefined?


null: empty value assigned, undefined: variable not assigned a value.

9. What is an arrow function?


Shorter syntax for functions, inherits this from surrounding scope.

10. Difference between map() and forEach()?


map returns a new array, forEach does not.

11. Difference between localStorage and sessionStorage?


localStorage: persistent data, sessionStorage: cleared when tab closes.

12. What is the DOM?


Document Object Model, represents HTML elements as objects.

13. Difference between async/await and Promises?


async/await is cleaner syntax to handle promises.

14. What is debouncing?


Delaying execution until a pause in events.

15. What is throttling?


Limiting the execution rate of a function

You might also like