10 JavaScript concepts need to know for the interview

Md. Dalwer Hossain
5 min readMay 8, 2021

--

What are Truthy and Falsy values?

Truthy expressions in JavaScript evaluate to boolean true values, while falsy expressions evaluate to boolean false values. It can take many different forms. Let’s look at what makes expressions true or false in JavaScript. Such as false, null, undefined, 0, -0, “ ” empty string, NaN.

What is Scope?

The scope is very important at javascript. You must be aware of where your declared variable/function can be accessed or used. If you want the declared variable/function to be private, or if you want to access your variable/function from anywhere, or if you want to know everything, then you will learn scoop. Basically, two types of variable that is -

  1. Local variable
  2. Global variable

The local variable is when you declared any variable inside any function that is a local variable and when you declared the outside the function any function can access this variable it’s called a global variable.

How works “this” in javascript?

In an object method, this refers to the method’s owner. This refers to a person object in the instance. The full name technique is owned by the person object.

Example:

What is Closure?

You call a function from some other function or return it, it creates a closed environment, and the function it was trying to call from the closed environment, if it accesses any variable from outside the function, it will also use that function, which has its own value. and each function will behave as if it were a closed environment value.

Example:

What is Event Loop in JavaScript?

JavaScript’s concurrency model is based on an event loop, which is in charge of executing code, collecting and processing events, and executing queued subtasks.

This diagram shows that four major events occurred during an event loop: call stack, browser API, event queue, and event loop. The call stack in JavaScript is in charge of keeping track of all the operations in a line that needs to be executed. When a function is completed, it rises to the top of the stack. After all, the function that called it sent a request to the browser API. The API begins its own single-threaded operation based on the command received from the call stack. The event queue’s function is to send new functions to the track for processing. It keeps a queue data structure for the correct sequence in which all the operators send their commands for execution. After completing one execution, the event loop continuously checks to see if the stack is empty.

What is event bubble in JavaScript?

The bubbles event property returns a Boolean value indicating whether an event is flowing or not.

Event bubbling is a technique for directing an event to its intended target. It works as follows when a button is pressed, the event is directed to the button.
The event is triggered if an event handler is configured for that object. If no event handler is assigned to that object, the event bubbles up to the object’s parent. The event cascades up from parent to parent until it is dealt with, or until it reaches. The event is passed down from parent to parent until it is handled or reaches the document object.

What are arrow functions?

There is no binding for arrow functions. This keyword represented the object that called the function throughout regular functions, which could be the window, the document, a button, or anything else. When it comes to arrow functions, the keyword always represents the object that defined the arrow function.

What is the filter?

The filter() method is similar to the map() method. However, if the applied function returns true, this item is stored in the new array. This item is not stored in the new array if the function does not return false.

What is the map?

When you use map with an array, each array item applies to the function you specify. The array item is then returned along with the other array. Assume you have an array and want to square each array item as a result. This operation works in two ways: one is a for loop, and the other is a compact and simple map (). You will get more ideas if you look at the given example.

What is API (Application Programming Interface)?

An API is a set of functions that allow programs to interact with external software modules, operating systems, or micro-services in order to access information and collaborate. The primary goal of API is to provide us with access to a collection of data that we can use in our applications.

--

--