Javascript Interview Question

Md Shohag Babu
5 min readNov 5, 2020
Interview Question Banner

What is truthy and falsy value in javascript?

There are some values in javascript that usually carry true or false values. If we check these values in the if-else condition in javascript, we will see that it gives true or false results. Some of these values are always given Falsy results that are calling falsy values in javascript.

  • Previous example result should be pass in the first condition

His name is Noah

  • If we don’t put ani value in the quotes then the result should pass the second condition which is false

like this, there are many values which give the falsy results they are:

  • NaN, empty String, Null, undefined, 0, “ ”, ‘ ’ etc these values are falsy value. and others are truth value

Null vs Undefined

If we don’t define any value which is supposed to be defined or forget to define, then which result has come that's called undefined. There are many reasons to get result undefined

Some reason for getting result undefined:

  • If we don’t put the value of the variable
  • For forget to return the function
  • Forget passing parameter
  • When we find that property which is not declared in the object

Null: Null means empty where there is no position in completion. Null is an assignment value in javascript. In some cases, Null is used as a variable to check the condition.

Undefined Example

Difference between == Equal and === Equal

In javascript double equal is firstly check the value of the variable if match then it should be ok but if not match then try to convert them the same and give the result. On the other hand, triple equal not only check the value it checks the type of value also after that it send result.

Double and triple equal

Definition of Map, Filter, and Find

Map: When we need to collect the same property from an array of objects then we can use Map. The map is used to find the same property as an array of objects.

Filter: Filtering is the selection of an object according to conditions from the array of objects.

Find: Find is also select the object but it can not select all objects which are similar to the condition it can give only the first object which is similar to the condition.

Find map filter

Scope and Hoisting

Scope: A scope is actually a specific place or area. Like if we declare a variable in a function then we can not access this variable from outside of the function another side we can say that we can not access this variable outside from the function scope.

Hoisting: If any variable declared inside the function with the var keyword and set any value to this variable then this variable is accessible from anywhere. so we can say hoisting is the act of taking a declared variable to a higher level.

scope and hoisting

What is Binding?

This is a special arrangement of applying the method of one object to another is called binding. if we want we can use this method as much as we want.

Binding Example Photo

Difference Between Class and Objects?

There are several differences between class and objects

  • Class is those things that can create objects with the help of a new keyword.
  • class is used to bind method and data together and it has logical existence
  • On the other hand object act like a variable of the class
  • And objects have a physical existence.
Create an object by class photo

Difference between call and apply?

Both call and apply are methods of a function object. The main difference between call and apply in javascript is call requires the arguments and to pass in one-by-one and apply takes the arguments as an array.

Call Apply Example

Factorial Number

Generally, we can say that factorial is multiplied all whole numbers from a given number down to 1.

In javascript, we can find out the factorial number of any number by using for loop or while loop. The method of finding the factorial value by using for or while loop is called the iterative way of find out the factorial.

For loop Iterative way Photo
Factorial by function

Fibonacci Number

Fibonacci is a sequence of numbers. Generally, we can say that a number is the sum of two previous numbers it starts from 0 and 1.

Fibonacci Example Photo

--

--

Md Shohag Babu
0 Followers

Front-end Javascript Developer. Enjoy to coding