Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

Most Frequently Asked JavaScript Interview Questions

Uploaded by

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

Most Frequently Asked JavaScript Interview Questions

Uploaded by

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

Most Frequently

Asked JavaScript
Interview
Questions
Are you new to JavaScript ? Wondering about
its benefits and the frequently asked
questions? This presentation will provide all the
answers you need!
by Gourav Roy
What is JavaScript ?
JavaScript is a high-level, interpreted programming language primarily used for web
development. It enables dynamic content on websites, interacts with users, and
enhances the user experience.
What are the key
differences between
let, const, and var ?

let and const are block-scoped, while var is


function-scoped. let allows reassignment,
const is for constant values, and var is
outdated.
Explain Hoisting in
JavaScript.
Hoisting is a behavior where variable and
function declarations are moved to the top of
their scope during compilation, allowing you to
use them before their actual declaration.
What is the Event Loop in JavaScript ?
The Event Loop is a mechanism that allows JavaScript to handle asynchronous
operations by placing them in a queue and executing them in a loop when the call
stack is empty.
Explain Closures in
JavaScript.
Closures are functions that have access to
variables from their outer (enclosing) scope,
even after that scope has finished execution.
They "close over" the variables.
What is the this keyword in JavaScript ?
this refers to the current execution context. Its value depends on how a function is
called. In a method, it refers to the object the method was called on. In a regular
function, it refers to the global object.
What is the difference
between == and ===?
== is the equality operator that performs type
coercion, while === is the strict equality
operator that checks both value and type
without coercion.
Explain the concept of callbacks.
Callbacks are functions passed as arguments to another function, which will be
invoked later after the completion of an asynchronous operation or a certain task.
What is the purpose of
the async and await
keywords ?
async is used to declare that a function returns
a promise, and await is used to pause the
execution of an async function until the
promise is settled.
How does prototypal
inheritance work in
JavaScript ?
JavaScript uses prototypal inheritance, where
objects can inherit properties and methods
from other objects. Each object has a
prototype object, and properties/methods not
found in the object itself are looked up in its
prototype chain.
What is the difference
between null and
undefined ?

null represents the intentional absence of any


object value, while undefined is the default
value of variables that have not been assigned
a value.
Explain the difference
between arrow
functions and regular
functions.
Arrow functions do not have their own this and
arguments, and they cannot be used as
constructors. They have a shorter syntax and
inherit this from the surrounding scope.
What is the purpose of
the map and filter
functions in JavaScript
?
The map function is used to transform each
element of an array, while the filter function is
used to create a new array with elements that
pass a certain condition.
How does the
localStorage differ
from sessionStorage ?
Both localStorage and sessionStorage are web
storage objects with the same API, but
localStorage persists even when the browser is
closed, while sessionStorage is limited to the
duration of the page session.
What is the purpose of
the JavaScript Promise
object ?
Promises are objects representing the eventual
completion or failure of an asynchronous
operation. They help in handling asynchronous
code in a more readable and manageable way.
Explain the Same-
Origin Policy .
The Same-Origin Policy is a security measure
in browsers that restricts web pages from
making requests to a different domain than the
one that served the web page.
What is the purpose of
the fetch API in
JavaScript ?
The fetch API is used to make network
requests. It returns a Promise that resolves to
the Response to that request, allowing for more
flexible and powerful HTTP requests compared
to the older XMLHttpRequest.
What is the JavaScript
spread syntax ?

The spread syntax (...) allows an iterable, like


an array or string, to be expanded in places
where zero or more arguments or elements are
expected.
Explain the concept of
Debouncing in
JavaScript .
Debouncing is a programming practice used to
ensure that time-consuming tasks do not fire
so often, making them more efficient by
delaying the execution until after a specified
time period has elapsed without further input.
How does the
localStorage differ
from cookies ?
localStorage is a form of web storage that
persists even when the browser is closed, while
cookies are small pieces of data sent from a
website and stored on the user's computer by
the browser, typically for session management.
Conclusion
JavaScript, with its ever-evolving ecosystem
and vibrant community, continues to shape the
digital landscape. As we navigate through its
intricacies, let's embrace the dynamic nature of
JavaScript and its role in building the future of
the web.

You might also like