0% found this document useful (0 votes)
5 views

JavaScript 30 Interview Question Answer

The document is a compilation of JavaScript interview questions and answers, categorized into basic, intermediate, and advanced levels. It covers fundamental concepts such as data types, functions, closures, asynchronous programming, and advanced topics like prototypal inheritance and memoization. The content serves as a study guide for individuals preparing for JavaScript interviews.

Uploaded by

Himalaya singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

JavaScript 30 Interview Question Answer

The document is a compilation of JavaScript interview questions and answers, categorized into basic, intermediate, and advanced levels. It covers fundamental concepts such as data types, functions, closures, asynchronous programming, and advanced topics like prototypal inheritance and memoization. The content serves as a study guide for individuals preparing for JavaScript interviews.

Uploaded by

Himalaya singh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

@coder.surya @coder.

surya @c
@coder.surya
JavaScript 30 Interview @coder.surya
Question + Answer @c
@coder.surya @coder.surya Basic Level
@c
@coder.surya @coder.surya @c
1. What is JavaScript?
Answer: JavaScript is a lightweight, interpreted programming language primarily used to
create interactive and dynamic web content. It's a client-side scripting language that can

@coder.surya @coder.surya @c
also be used server-side through environments like Node.js.

2. What are the data types in JavaScript?

@coder.surya @coder.surya @c
Answer: JavaScript has several data types: Primitive types (Number, String, Boolean,
Undefined, Null, BigInt, Symbol) and Non-Primitive types (Object, Array).

@coder.surya @coder.surya @c
3. Explain var, let, and const.
Answer:

@coder.surya @coder.surya @c
var is function-scoped and can be redeclared and updated.
let is block-scoped and can be updated but not redeclared within the same scope.
const is block-scoped and neither can be updated nor redeclared.

@coder.surya @coder.surya @c
4. What is == vs === in JavaScript?
Answer: == checks for equality after type conversion (loose equality), while === checks

@coder.surya @coder.surya @c
for equality without type conversion (strict equality).

5. What is null vs undefined?

@coder.surya @coder.surya @c
Answer: null is an assignment value representing "no value," while undefined means a
variable has been declared but has not been assigned a value.

@coder.surya @coder.surya @c
6. Explain NaN in JavaScript.
Answer: NaN stands for "Not-a-Number." It's a special value in JavaScript that results

@coder.surya @coder.surya @c
when a mathematical operation fails, like parseInt('abc').

7. What are JavaScript functions?

@coder.surya @coder.surya @c
Answer: Functions are blocks of code designed to perform specific tasks. They can take
parameters and return a value.

@coder.surya @coder.surya @c
Complete PDF Version Of This Post Is Available in our
Telegram Channel 🫰LINK IN BIO👑
@coder.surya @coder.surya @c
@coder.surya
JavaScript 30 Interview @coder.surya
Question + Answer @c
@coder.suryaBasic @coder.surya
Level @c
@coder.surya @coder.surya @c
1. What is an anonymous function?
Answer: An anonymous function is a function without a name, often used in situations
where functions are used as arguments or within closures.

@coder.surya @coder.surya @c
2. Explain arrow functions.

@coder.surya @coder.surya @c
Answer: Arrow functions provide a shorter syntax for writing functions using =>. They
inherit the this value from their enclosing context.

@coder.surya @coder.surya @c
3. What is an Immediately Invoked Function Expression (IIFE)?
Answer: An IIFE is a function that is defined and immediately executed. Syntax: (function()

@coder.surya @coder.surya @c
{ ... })();

@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya @coder.surya
Complete PDF Version Of This Post Is Available in our
Telegram Channel 🫰LINK IN BIO👑
@c
@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya
JavaScript 30 Interview @coder.surya
Question + Answer@c
@coder.surya @coder.surya @c
Intermediate

@coder.surya @coder.surya @c
11. What is a closure in JavaScript?
Answer: A closure is a feature in JavaScript where an inner function has access to
variables in its outer function scope, even after the outer function has returned.

@coder.surya @coder.surya @c
12. What is the purpose of this keyword?

@coder.surya @coder.surya @c
Answer: this refers to the context in which a function is called. Its value depends on how
the function is invoked (e.g., object method, standalone function, arrow function).

@coder.surya @coder.surya @c
13. Explain event delegation.
Answer: Event delegation is a technique where a single event listener is added to a parent

@coder.surya @coder.surya @c
element instead of multiple listeners on individual child elements, utilizing event bubbling.

14. What is the difference between synchronous and

@coder.surya @coder.surya @c
asynchronous code in JavaScript?
Answer: Synchronous code is executed line-by-line, blocking the next line until the

@coder.surya @coder.surya @c
current one completes. Asynchronous code allows the program to continue running, using
callbacks, promises, or async/await.

@coder.surya @coder.surya @c
15. What are promises in JavaScript?
Answer: A promise is an object representing the eventual completion or failure of an
asynchronous operation. It has three states: pending, fulfilled, and rejected.

@coder.surya
16. Explain async and [email protected] @c
@coder.surya @coder.surya @c
Answer: async is used to declare asynchronous functions, and await is used to pause the
function execution until a promise is resolved.

17. What is hoisting in JavaScript?


@coder.surya @coder.surya @c
Answer: Hoisting is a behavior where variable and function declarations are moved to the
top of their scope before code execution. Variables declared with var are hoisted, but not

@coder.surya @coder.surya @c
initialized.
@coder.surya @coder.surya @c
@coder.surya
JavaScript 30 Interview @coder.surya
Question + Answer @c
@coder.surya @coder.surya @c
Intermediate

@coder.surya @coder.surya @c
18. What is the bind() method?
Answer: bind() creates a new function that, when invoked, has its this value set to a
specific object.

@coder.surya @coder.surya @c
19. Explain call() and apply() methods.

@coder.surya @coder.surya @c
Answer: Both call() and apply() invoke a function with a specified this context. call() takes
arguments individually, while apply() takes them as an array.

@coder.surya @coder.surya @c
20. What are higher-order functions?
Answer: Higher-order functions are functions that can take other functions as arguments

@coder.surya @coder.surya @c
or return them as output.

@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya @coder.surya
Complete PDF Version Of This Post Is Available in our
Telegram Channel 🫰LINK IN BIO👑 @c
@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya
JavaScript 30 Interview @coder.surya
Question + Answer@c
@coder.suryaAdvanced @coder.surya @c
@coder.surya @coder.surya @c
21. What is the event loop in JavaScript?
Answer: The event loop is a mechanism in JavaScript that manages asynchronous
callbacks. It continuously checks the call stack and the callback queue to execute code in

@coder.surya @coder.surya @c
a non-blocking manner.

22. Explain prototypal inheritance in JavaScript.


@coder.surya @coder.surya @c
Answer: Prototypal inheritance is a feature where objects inherit properties and methods
from other objects through the prototype chain.

@coder.surya @coder.surya @c
23. What is the purpose of the new keyword?
Answer: new is used to create an instance of an object with a constructor function, setting

@coder.surya @coder.surya @c
this to refer to the new object and linking it to the prototype.

24. What is the purpose of Object.create()?

@coder.surya @coder.surya @c
Answer: Object.create() creates a new object with a specified prototype object and
properties, allowing for prototypal inheritance without using a constructor.

@coder.surya @coder.surya @c
25. Explain debouncing and throttling.
Answer:
Debouncing delays function execution until a specified period of inactivity.

@coder.surya @coder.surya @c
Throttling ensures a function is only executed once in a specific interval.

26. What are modules in JavaScript?


@coder.surya @coder.surya @c
Answer: Modules allow for separation of code into smaller parts, each with its own scope,
improving maintainability. CommonJS, AMD, and ES6 modules are popular module

@coder.surya @coder.surya @c
systems.

27. Explain the concept of currying in JavaScript.

@coder.surya @coder.surya @c
Answer: Currying is the process of transforming a function that takes multiple arguments
into a series of functions that each take a single argument.

@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya
JavaScript 30 Interview @coder.surya
Question + Answer @c
@coder.suryaAdvanced @coder.surya @c
@coder.surya @coder.surya @c
28. What is memoization in JavaScript?
Answer: Memoization is an optimization technique where results of function calls are
cached to avoid redundant calculations.

@coder.surya @coder.surya
29. Explain the Singleton pattern.
@c
@coder.surya @coder.surya @c
Answer: The Singleton pattern restricts a class to a single instance and provides global
access to that instance, useful for managing global states.

@coder.surya @coder.surya @c
30 What are generators in JavaScript?
Answer: Generators are functions that can pause and resume execution using the yield

@coder.surya @coder.surya @c
keyword, making them useful for handling asynchronous code and lazy execution.

@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya @coder.surya @c
@coder.surya @coder.surya
Complete PDF Version Of This Post Is Available in our
@c
Telegram Channel 🫰LINK IN BIO👑
@coder.surya @coder.surya @c

You might also like