Common Javascript Interview Question

1| Use of Double Equal (==) vs Triple Equal (===)?

Double (==)
Double equal (==) is used for only comparing two different variable’s values only.
Triple (===)
On the other hand Triple (===) is checking the variable’s Value and Type both.

2| What is Scope and Scope Variable? How does it work?

The scope is like a boundary. When you declare a function it makes a Scope.
Basically, Scope has 2 categories
*Global Scope
*Local Scope

Global Scope:
Global Scope means, if you want to declare a variable live var, you can access it in the functions var is a global variable that’s why you access it anywhere in your app. And easily use it inside the functions or outside the functions.

Local Scope:
On other hand, if you declare a variable in the functions of ES6, like Let, Const you can only access it in your functions.it means in your Scope/Private Scope. If you trying to access it outside the functions or anywhere, Javascript can not find it and Javascript gives you an Error for it. But you access the Functions anywhere.

3| What is Hoisting?

Hoisting is Javascript‘s default behavior. When Javascript scanning in your code that time Hoisting takes all are the Javascript declarations in the first. It calls Hoisting.

4| What is Bind, Call, Apply?

Bind-
Bind is a method of binding one function to another. when you need a different function attach your main function so you its do use it with the Bind method. after binding this method, you access it from one function to another function.

Call and Apply-
when you use the bind method it does not call immediately, it takes some time. But the Apply and Call method respond immediately. The call and Apply methods are almost similar. but there was a small difference. that is you do pass many arguments in the call method, on the other hand, apply method takes 2 arguments just.

5| How Find Largest Element in Array?

Whenever you need to find the largest element of an Array, you should have 2 options to find it.

6| How Remove Duplicate Item from an Array?

If you remove repeating element form and you just apply a single method is-

Var number = [your elements];

Var afterRemove = […new Set(number)];

console.log(afterRemove);

7| How Count Word Number of String?

When you need to know how many words in your string, then you just apply this method which I provide in the under-

Var paragraph = “your paragraph”;

console.log(paragraph.length);

8|What is API, Get, and POST? and How it Work?

API-
API is a link/URL, there are many data saves in this link. when we need dynamic data to show on our app then we create an API link/URL, put the all data as JSON format in the API, and use data that is necessary for us from this link/API.

GET-
When we need data from the API link, first we call API link, load data in the application, and then we use the GET method to get data to show our UI.

POST-
It is also similar to the GET method. but they work differently. To post data on the server from UI. Basically, it posts data on the server and the server saves this data on the database.

Ex-contact-form.

9| What is Dom?

Dom is a Document object Model. It is compiling our HTML in the browser and showing on our document as content.

10| What is Event Bubbling?

An Event bubble is like a tree. it has a parent-child relation. when we work on a nested function its creates an effect on the main function. and it's called an Event Bubble.

Assalamu Alaikum!This is Hasan Rana.I learn Web Developmet and i love to do Coding!!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store