Q1.What is the difference between var, let, and const?
var is function-scoped and hoisted. let and const are block-scoped. const cannot be reassigned.
Get the Preplance app for a seamless learning experience. Practice offline, get daily streaks, and stay ahead with real-time interview updates.
Get it on
Google Play
4.9/5 Rating on Store
The most frequently asked JavaScript interview questions for freshers and experienced developers.
var is function-scoped and hoisted. let and const are block-scoped. const cannot be reassigned.
A closure is a function that remembers its outer variables and can access them even when called independently.
The Event Loop is a mechanism that allows JavaScript to perform non-blocking I/O operations by offloading operations to the system kernel whenever possible.
'this' refers to the object that is executing the current function. Its value depends on how the function is called.
== performs type coercion before comparison, while === checks for both value and type equality.