10 important questions for the interview

Pronoy Das
4 min readMay 8, 2021

1.Null Vs Undefined

Null: Null is an empty or non-existent value. Null must be assigned. Null in JavaScript is an assignment value. The Null keyword is used to define the Null type in TypeScript, but it is not useful because we can only assign a null value to it. Null means absence of a value.

Undefined: Undefined most typically means a variable has been declared, but not defined. Undefined is a type. It represents uninitialized variables in TypeScript and JavaScript. It has only one value, which is undefined.

2. Double equal (==) vs Triple equal (===)

Double equal (==): Double equals in JavaScript, we are testing for loose equality. Double equals also perform just value checks, not data type checks.

Following the example, we can see 77 equal and string type 77 that is true for double equal. Double equal not checks in data types.

Triple equal (===): Triple equals in JavaScript, we are testing for strict equality. This means both the type and the value we are comparing have to be the same.

Following the example, we can see Number and string type not the same, so the type and value are not the same then false for triple equal.

3.this keyword

A function’s this keyword behaves a little differently in JavaScript compared to other languages. It also has some differences between strict mode and non-strict mode. In strict mode, this is undefined. In a method, this refers to the owner object.

In this example, we can see that this keyword use in the inner function. this. prop means that function props value to return.

4.Difference between bind, call and apply

call(): The call() method invokes a function with a given ‘this’ value and arguments provided one by one. This means that we can call any function, and explicitly specify what ‘this’ should reference within the calling function.

Apply( ): Invokes the function and allows you to pass in arguments as an array.

Bind(): Returns a new function, allowing you to pass in an array and any number of arguments.

5.Closure

Closure is one of the important concepts in JavaScript.Closure means that an inner function always has access to the vars and parameters of its outer function, even after the outer function has returned. The closure is useful in hiding implementation detail in JavaScript. In other words, it can be useful to create private variables or functions.

6.What is DOM?

The Document Object Model (DOM) is a programming interface for HTML
and XML(Extensible markup language) documents. It defines the logical structure of documents and the way a document is accessed and manipulated.

The Document Object Model (DOM) is a programming interface for HTML and XML documents. It represents the page so that programs can change the document structure, style, and content. The DOM represents the document as nodes and objects. That way programming languages can connect to the page.

7.What is an API?

API stands for Application Programming Interface. At some point or another, most large companies have built APIs for their customers, or for internal use.

API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other.

An API is a set of programming code that enables data transmission between one software product and another. It also contains the terms of this data exchange.

8.What are the differences between recursion and iteration?

Recursion:

Recursion uses a selection structure. Infinite recursion occurs if the recursion step does not reduce the problem in a manner that converges on some condition (base case) and Infinite recursion can crash the system. It terminates when a base case is recognized. It is usually slower than iteration due to the overhead of maintaining the stack. It uses more memory than iteration. Recursion makes the code smaller.

Iteration:

Iteration uses repetition structure. An infinite loop occurs with iteration if the loop condition test never becomes false and Infinite looping uses CPU cycles r
repeatedly. An iteration terminates when the loop condition fails. An iteration does not use the stack so it’s faster than recursion. Iteration consumes less memory. Iteration makes the code longer.

9.JavaScript Events

The change in the state of an object is known as an Event. In HTML, there are various events that represent that some activity is performed by the user or by the browser. When javascript code is included in HTML, js react over these events and allow the execution. This process of reacting to the events is called Event Handling. Thus, js handles the HTML events via Event Handlers.

10.Asynchronous Javascript

Functions running in parallel with other functions are called asynchronous. A good example is JavaScript setTimeout(). Asynchronous means that things can happen independently of the main program flow. In the current consumer computers, every program runs for a specific time slot, and then it stops its execution to let another program continue its execution.

--

--

Pronoy Das
0 Followers

I am a web developer. I am also hardworking and dedicated person .