Some Interview Question

Rahad Ahmed
2 min readMay 8, 2021

JavaScript

  1. What is truthy and falsy value of JavaScript?

To declare condition, if the value of condition becomes 0, empty string, undefined, null, Nan or false then it call Falsy Value.
On the other hand, if the value of condition becomes not an empty string, array or object then it calls truthy value.

2. What is undefined vs null?

If we don’t define, return or set any value and property of any variable, function, object the result will be undefined.
Null means empty, not existence. It expresses a lack of identification, indicating, that a variable points to no object.

3. What is the difference between “==” and “===”?

== is used for comparing two variable but it ignores the datatype of variable and === is used for comparing two variables, but this operator also checks datatype and compares two values.

4. What is closure?

In a function if there is another function and the 2nd function or insider function return or use that create a close environment and it keeps a external variable for its reference, it called closure.

5. What is scope?

Scope is that kind variable which can be access. In javascript object and function can be used as a variable. Here, scope is variable, object and function’s set which can be access.

6. What is local scope?

Inside function which variable declares is called local scope. Its scope is local. The variable only uses inside of that function.

7. What is global scope?

Outside of function which variable declares is called global scope. This variable’s scope is global. That can be accessed from web page’s all script and function.

8. What is Block scope?

A block scope is the area within if, switch, conditions or for and while loop. In ES6, const and let keywords allow developers to declare variable in the block scope which means those variable exist only within the corresponding block.

9. What is the bind() method?

The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.

10. What is window JS?

It represents the browser’s window. All global javascript objects, functions, and variables automatically become members of the window object. Global variables are properties of the window object. Global functions are methods of the window object.

--

--