10 JavaScript interview question answer every developer should know

10 JavaScript interview question answer every developer should know

JavaScript interview question

·

2 min read

programming-1873854_1280.png

1.Null vs Undefined

null means there is no value assigned in a variable. But undefined is mean value is declared but not defined.

2.Truthy and Falsy values

Truthy value is that considered true and false value is false.

3. Double equal & Triple equal

In double equal (==) check value equality and convert the variable data type to make equal. Triple equal (===) means both the data type and the value we are comparing have to be the same.

4. What is Scope?

The scope is the accessibility of variables. If I declare a variable into a function I can't call it from outside of the function. That is scope.

5. Difference between bind, call, and apply

Bind: returns a new function, allowing you to pass in this array and any number of arguments.
Call: call the function and allows you to pass in arguments one by one.
Apply: call the function and allows you to pass in arguments as an array.

6. Global variable & Global Scope

A variable declared outside a function becomes GLOBAL. A global variable has the global scope: All scripts and functions on a web page can access it.

7. Difference between Let and Const

let is defined when a variable value is changeable or in future may change. const is defined when a variable value will not changed in future.

8. What is DOM?

The DOM defines a standard for accessing documents. By DOM method Javascript can change or do anything In an HTML document

8. What is an API

API full meaning is Application Programming Interface. It works as a third party that allows transferring data one from another.

9. What is Recursion

Recursion is a process where a function calls itself.

10. What is Encapsulation

Encapsulation is an approach for forbidden direct access to some of the data elements.