1. What is JavaScript and where is it commonly used?
[01:54]
JavaScript is a high-level programming language used to create
interactive and dynamic effects within web browsers. It is commonly
used for developing both frontend web interfaces and backend server
applications.
2. What are template literals in JavaScript? [02:14]
Template literals use backticks () and allow you to embed variables and
expressions directly into a string using ${}`. They make string
concatenation much cleaner, readable, and flexible.
3. What is hoisting and give an example? [03:02]
Hoisting is JavaScript's default behavior of moving variable and function
declarations to the top of their scope before execution. This allows you
to call a function before it is physically declared in the code without
throwing an error.
4. Explain the difference between let, var, and const. [04:11]
var has a global/function scope and can cause unexpected bugs. let and
const have block scope (like inside an if-statement), but const
additionally prevents the variable from being reassigned later.
5. What are data types available in JavaScript? [05:43]
Data types are split into primitives (immutable: Number, String, Boolean,
Undefined, Null, Symbol, BigInt) and non-primitives (mutable: Object,
Array, Function).
6. What is an array in JavaScript and how do you access its elements?
[07:56]
An array is an ordered collection of values or elements stored in a single
variable. Elements are accessed dynamically using their zero-based
index (e.g., array[0]) or by iterating with loops.
7. Explain the difference between == and === in JavaScript. [08:35]
Double equals (==) is the equality operator that performs "type
coercion", meaning it can convert a string "5" to match a number 5.
Triple equals (===) is strict equality and checks if both the value AND
the data type are identical.
8. What is the purpose of the isNaN() function? [09:16]
isNaN() stands for "Is Not-a-Number." It checks if a given value cannot
be coerced or converted into a valid number, returning true for random
text strings and false for valid numbers.
9. What is null and undefined? [10:04]
undefined means a variable has been declared but has no assigned
value yet (it's the default state). null is a deliberate assignment to
intentionally show the absence of any value.
10. Explain the use of the typeof operator. [10:44]
The typeof operator determines the data type of a given value or
variable and returns it as a string (like "boolean" or "object"). It's highly
useful for input validation.
11. What is the purpose of the map() method in JavaScript? [11:15]
The map() method creates a brand new array by taking an existing array
and applying a specified function to every single element inside it,
without altering the original array.
12. What is event bubbling and event capturing in JavaScript? [13:51]
Event capturing executes an event starting from the outermost parent
element down to the innermost target child. Event bubbling does the
opposite, firing from the innermost targeted child and bubbling up to the
outermost parent.
13. What are higher-order functions? Can you give an example? [20:25]
A higher-order function is a function that can either take another function
as an argument or return a function as a result. [Link]() is a prime
example because it accepts a callback function as its argument.
14. What is an IIFE (Immediately Invoked Function Expression) in
JavaScript? [22:25]
An IIFE is a JavaScript function that is defined and executed
immediately right after it is created, without needing to be explicitly
called elsewhere in the code.
15. What do you understand by closures in JavaScript? [24:37]
A closure is an inner function that remembers and accesses the
variables (the environment) of its outer parent function, even after the
parent function has finished executing. It's often used to create private
variables.
16. How do setTimeout and setInterval work? [30:11]
setTimeout schedules a task or function to execute exactly once after a
specified delay. setInterval repeatedly executes a function continuously
at set time intervals until it is explicitly cleared.
17. Explain the concept of Promises in JavaScript. [35:23]
Promises handle asynchronous tasks by providing a structured way to
manage future results (like fetching APIs). They exist in three states:
pending, fulfilled (success), and rejected (error).
18. What is the use of async and await in JavaScript? [39:11]
async declares a function that returns a promise. await is placed inside
the async function to pause the execution of that specific block until the
promise is resolved, allowing background tasks to load cleaner than
standard promise chaining.
19. What is the difference between call, apply, and bind? [43:00]
call invokes a function immediately, passing arguments one by one.
apply invokes immediately but takes arguments as a grouped array. bind
creates a new assigned function with arguments to be invoked later.
20. What is event delegation? [50:00]
Event delegation leverages event bubbling to attach a single event
listener to a parent element, rather than individual listeners to multiple
children. This dramatically improves performance, especially with
dynamic elements.
21. Explain the Event Loop in JavaScript. [57:46]
The Event Loop is an internal monitoring mechanism that handles
asynchronous tasks. It checks if background tasks (like API fetches) are
done, and then pushes those completed callback functions onto the
main execution thread.
22. What is the difference between a Promise and an async/await
function? [59:38]
Promises are the underlying mechanism for asynchronous tasks utilizing
complex .then() and .catch() chains. async/await is a cleaner, more
readable syntax wrapper built directly on top of Promises.
23. Describe the purpose of the reduce() method in Array. [01:03:45]
The reduce() method condenses an entire array into a single resulting
value (like a sum or average) by executing a callback function that
passes an accumulating value through every element.
24. Explain the concept of currying in JavaScript. [01:08:18]
Currying transforms a standard function that takes multiple arguments at
once into a sequence of nested functions that each take exactly one
argument. It creates highly reusable and flexible functional templates.
25. What is a generator function and how is it used? [01:12:35]
A generator function (function*) is a function that can pause its
execution mid-way using the yield keyword and resume later on
command. It prevents browser crashing by managing things like infinite
loops efficiently.
26. What are WeakMaps and WeakSets in JavaScript? [01:15:50]
WeakMaps and WeakSets are special temporary data collections that
strictly hold object references. They are "weak" because if an object
loses its reference elsewhere in the code, the memory is automatically
cleared out (garbage collected).
27. How does JavaScript handle memory management? [01:19:34]
JS uses Stack memory for temporary primitive types and Heap memory
for complex objects. It features an automated "Garbage Collector" that
routinely sweeps away variables that no longer reference any active
objects or data.
28. Describe the difference between shallow and deep copying.
[01:21:18]
A shallow copy duplicates an object but keeps nested references linked
to the original (modifying the copy alters the original). A deep copy
clones the object and all internal nesting completely, severing all ties to
the original.
29. What is JavaScript strict mode and how is it enabled? [01:25:48]
Strict mode ("use strict";) imposes a stricter set of rules on JavaScript,
throwing active errors for bad syntax (like undeclared variables or bad
read-only assignments) that standard JS would silently ignore.
30. Explain the Observer pattern and how it relates to JavaScript.
[01:32:36]
The Observer pattern is a design model where a subject (like a button or
data state) maintains a list of dependents (observers) and instantly
broadcasts notifications to them whenever its state changes, commonly
seen via Event Listeners.