Popular JavaScript Interview Questions with Answers.

JavaScript is the most popular language with ample of job opportunities. Here is the list of 20 most asked javascript interview questions to speed up your preparation.

🧵 Thread 🧵
#100DaysOfCode #DEVCommunity
1. what's the difference between undefined and null?

"undefined" is the default value of a variable that has not been assigned a specific value and "null" is a value that represents no value.

#100DaysOfCode
2. What does the && operator do?

The && or Logical AND operator finds the first falsy expression in its operands and returns it and if it does not find any falsy expression it returns the last expression.

#100DaysOfCode
3. What does the || operator do?

The || or Logical OR operator finds the first truthy expression in its operands and returns it. This too employs short-circuiting to prevent unnecessary work.

#100DaysOfCode
4. What is DOM?

DOM stands for Document Object Model is an interface (API) for HTML and XML documents. When the browser first reads our HTML document it creates a big object, a really big object based on the HTML document this is the DOM.

#100DaysOfCode
5. What is Event Propagation?

Event propagation is a mechanism that defines how events propagate or travel through the DOM tree to arrive at its target and what happens to it afterward.

#100DaysOfCode
6. What's Event Bubbling?

In the Bubbling Phase, the event bubbles up or it goes to its parent, to its grandparents, to its grandparent's parent until it reaches all the way to the window.

#100DaysOfCode
7. What's Event Capturing?

In Capturing Phase, the event starts from the window all the way down to the element that triggered the event.

#100DaysOfCode
8. What is http://event.target  ?

The http://event.target  is the element on which the event occurred or the element that triggered the event.

#100DaysOfCode
9. What's the difference between == and === ?

The difference between ==(abstract equality) and ===(strict equality) is that the == compares by value after coercion and === compares by value and type without coercion.

#100DaysOfCode
10. Why does it return false when comparing two similar objects in JS?

JS compares objects and primitives differently. In primitives, it compares them by value while in objects it compares them by reference or the address in memory where the variable is stored.

#100DaysOfCode
11. What does the !! operator do?

The Double NOT operator or !! coerces the value on the right side into a boolean. Basically, it's a fancy way of converting a value into a boolean.

#100DaysOfCode
12. How to evaluate multiple expressions in one line?

We can use the , or comma operator to evaluate multiple expressions in one line. It evaluates from left-to-right.

Example -

x = (x++ , x = addFive(x), x *= 2, x -= 5, x += 10);

#100DaysOfCode
13. What is Hoisting?

Hoisting is the term used to describe the moving of variables and functions to the top of their (global or function) scope on where we define that variable or function.

#100DaysOfCode
14. What is Scope?

Scope in JavaScript is the area where we have valid access to variables or functions.

JavaScript has three types of Scopes -

1. Global Scope
2. Function Scope
3. Block Scope(ES6).

#100DaysOfCode
15. What are the falsy values in JavaScript?

falsy values are values that when converted to boolean becomes false.

#100DaysOfCode
16. What does "use strict" do?

"use strict" is an ES5 feature in JavaScript that makes our code in Strict Mode in functions or entire scripts. Strict Mode helps us avoid bugs early on in our code and adds restrictions to it.

#100DaysOfCode
17. What's the value of this in JavaScript?

"this" refers to the value of the object that is currently executing or invoking the function.

#100DaysOfCode
18. What is the prototype of an object?

A prototype in simplest terms is a blueprint of an object. It is used as a fallback for properties and methods if it does exist in the current object. It's the way to share properties and functionality between objects.

#100DaysOfCode
19. What are Higher Order Functions?

Higher-Order Function is functions that can return a function or receive argument or arguments which have a value of a function.

#100DaysOfCode
20. What's the difference between var, let, and const keywords?

Variables declared with "var" keyword are function scoped. Variables declared with "let" and "const" keyword are block-scoped.
Difference b/w let & const we can assign new values using let but we can't in const.
21: Learn 8 Console Methods to better code with JS

1. Console.log('use this')
2. Console.error('you made a mistake')
3. Console.assert(ele , ' here is the error')
4. Console.clear()
5. Console.count()
6. Console.warn('warning from here')
7. Console.time()
8. Console.timeEnd()
22. Array.Every

You can use Array.Every() if you want to know whether it's elements of array pass a certain test!

The output is True Or False, basically it checks each element and tries to the test pass!

#100DaysOfCode
You can follow @_born_may.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: