Important JavaScript Concepts Every Developer Must Know
Important JavaScript Concepts Every Developer Must Know
JAVASCRIPT
CONCEPTS
FOR INTERVIEWS
1 New features in ES6 version.
Arrow functions.
Multi-line Strings.
Promises.
Curated by
Is javascript a statically
2 dynamically typed language?typed or a
Curated by
Explain scope
3 JavaScript and scope chain
Example:
var x = 2;
Example:
let x = 1;
Curated by
JavaScript has the following kinds of scopes:
Function Scope: In JavaScript, every new function results in the
generation of a fresh scope. Variables declared inside a
function cannot be accessed from outside the function or from
another function. When used inside of a function, var, let, and
const all act similarly. The scope created with a function.
Example:
function myFunction() {
From To
Success
Akansha Likhdhari Story
Curated by
What are the differences between
4
var, const & let in JavaScript?
The scope of a var variable The scope of a let variable The scope of a let variable
redeclared into the scope. cannot be re-declared into redeclared into the scope.
the scope.
‘referenceError’. initialization.
Hoisting done, with Hoisting is done, but not Hoisting is done, but not
initializing as ‘default’ value initialized (this is the reason initialized (this is the reason
initialization initialization
Curated by
5 What is hoisting in JavaScript?
Declaration
a=1:
alert(a=’+a);
Curated by
6 Explain temporal dead zone.
let num;
function func(){
greeting = "Hi"; //
func();
Curated by
7 What is closure in JavaScript?
Curated by
9 What is NaN property?
For E.g.:
Math.sqrt(-1);
parseInt("Hello");
Curated by
9 What is the difference between null
10
and undefined?
null undefined
It is not an assignment
It is an assignment value value where a variable has
which indicates that been declared but has not
variable points to no object. yet been assigned a value
Curated by
What are the terms BOM and DOM
191
in JavaScript?
DOM stands for Document Object Model and BOM for Browser
Object Model.
DOM: An element may be added, changed, or removed from a
document using the Document Object Model (DOM), a
programming interface for HTML and XML documents. It
specifies how a document is accessed and handled, as well as
its logical structure. The DOM allows the webpage to be
represented as a structured hierarchy, making it simple to
access and modify HTML tags, IDs, classes, attributes, and
elements using the Document object's provided commands
and methods. This makes it easier for programmers and users
to understand the document.
DOM provides several methods to find & manipulate the
behavior of the HTML element:
getElementById() Method
getElementsByClassName() Method
getElementsByName() Method
getElementsByTagName() Method
querySelector() Method
querySelectorAll() Method
Curated by
BOM: is a browser-specific convention referring to all the
objects exposed by the web browser. The BOM allows
JavaScript to “interact with” the browser. The window object
represents a browser window and all its corresponding
features. A window object is created automatically by the
browser itself. JavaScript’s window.screen object contains
information about the user’s screen.
screen.width
screen.height
screen.availWidth
screen.availHeight
screen.colorDepth
screen.pixelDepth
window.open() Method
window.close() Method
window.moveTo() Method
window moveBy() Method
window.resizeTo() Method
Curated by
192 What is Critical Rendering Path?
From To
Success
Gen Story
Ajay Kumar
Curated by
9 What are basic JavaScript array
13
methods?
Syntax: Array.pop()
Curated by
map() method: The map() method in JavaScript creates an
array by calling a specific function on each element present in
the parent array. It is a nonmutating method. Generally, the
map() method is used to iterate over an array and call the
function on every element of an array.
Syntax: Array.map(function(currentValue,
Syntax: Array.reduce(function(total,
Curated by
9 What is the rest parameter and
14
spread operator?
Rest parameter ( … ):
Syntax:
function extractingArgs(...args){
return args[1];
} // extractingArgs(8,9,1); // Returns 9
function addAllArgs(...args){
let sumOfArgs = 0;
let i = 0;
sumOfArgs += args[i];
i++;
return sumOfArgs;
Curated by
Note- Rest parameter should always be used at the last
parameter of a function.
Syntax:
function addFourNumbers(num1,num2,num3,num4){
return num1 + num2 + num3 + num4;
addFourNumbers(...fourNumbers);
// Spreads [5,6,7,8]
console.log(mergedObj);
Curated by
9 Explain this keyword
15
Tutort Benefits
Curated by
9 Explain call(), apply() and, bind()
16
methods.
We use call, bind and apply methods to set the this keyword
independent of how the function is called. This is especially
useful for the callbacks.Every function object is also given a few
unique methods and attributes by JavaScript. These are the
methods that every JavaScript function inherits. Every function
inherits certain methods, such as call, bind, and apply.
bind(): The bind method creates a new function and sets the
this keyword to the specified object.
Syntax:
function.bind(thisArg, optionalArguments)
For example:
const john = {
name: 'John',
age: 24,
};
const jane = {
};
Curated by
Let’s add a greeting function:
function greeting() {
For example:
Call(): The call method initializes the this inside the function
and launches it right away. In contrast to bind(), which
produces a copy of the function and sets the this keyword,
call() sets the this keyword, executes the function instantly, and
does not create a new copy of the function.
Curated by
Syntax: function.call(thisArg, arg1, agr2, ...)
For example:
function greeting() {
const john = {
name: 'John',
age: 24,
For example:
Curated by
function greet(greeting, lang) {
console.log(lang);
console.log(`${greeting}, I am ${this.name}
age: 24,
};
Curated by
Is JavaScript single-threaded, if yes then how it
197 works as an multi-threaded language? OR
What is event loop in javascript?
async actions
settled
retu
.then(onFulfillment) rn
pending f ulfill pending
.then()
promise n
promise
.catch()
...
.then(...,onRejection) retur
.catch(onRejection)
error handling
Curated by
17This lets asynchronous methods return values like synchronous
methods: instead of immediately returning the final value, the
asynchronous method returns a promise to supply the value at
some point in the future.
Syntax:
Curated by
await function is used to wait for the promise. It could be used
within the async block only. It makes the code wait until the
promise returns a result. It only makes the async block wait.
Syntax:
console.log(x);
Curated by
9 What is callback hell?
19
Syntax:
async1(function(){
async2(function(){
async3(function(){
async4(function(){
....
});
});
});
});
Curated by
9 What are observables?
20
subscriber.next(1);
subscriber.next(2);
subscriber.next(3);
subscriber.complete();
});
Curated by
What are the differences between
291
promises and observables?
Promises Observables
Cancelled by using
Cannot be cancelled unsubscribe() method
Curated by
What is the difference between setTimeout,
22
9 setImmediate and process.nextTick?
From To
Success
Ajay Kumar Story
Curated by
9 What is microtask in JavaScript?
23
Additionally, a pure function does not result in any side effects that
can be seen, such as network queries, data alteration, etc.
Curated by
9
25 What is an error object and its
different error name object?
Syntax:
try { greeting("Welcome");
} catch (err) {
console.log(err.name + "
" + err.message);
Curated by
9
26 What are the various statements in
error handling?
Curated by
What do you mean by strict mode in
27
9 javascript and characteristics of javascript
strict-mode?
Curated by
What are the differences between cookie,
28
9 local storage and session storage?
As configured using expires Lifetime is until deleted Lifetime is until tab is closed
option
1250+ Career
Transitions 350+ Hiring
CTC
One of the best institutes for getting started with DSA and System Design.
Placed at It also assisted me in launching my technical career and in honing my
problem-solving and coding abilities. I was placed in more than 6+
Avishkar Dalvi product based companies because of their constant support.
Curated by
9 Explain prototype chaining
29
Curated by
9 What are generators and what are
30
its different kinds?
Curated by
9 Difference between Debouncing
31
and Throttling.
Debouncing Throttling
Syntax:
Syntax:
return function () {
let shouldWait = false;
const context = this;
return (...args) => {
};
};
} }
Curated by
Start Your
Upskilling with us
Explore our courses
www.tutort.net
Follow us on