10 Commonly Asked Interview Questions in JavaScript

What are Falsy values and Truthy values?

Values that generally returns false is called falsy values in JavaScript. And some falsy values are : “”, 0, undefined, NaN, null, False etc.

What is the main difference between ‘null’ and ‘undefined’?

I will make it easy for you by giving some examples.

What is Scope?

Scope determines accessibility or visibility of variables. A global value can be accessed from anywhere within the code. But a local variable can only be accessed from the local scope only.

What Is Closure?

If a function is declared within another function and we call the upper level function along with the function in it, then they both can have values of their own. This is called closure in JavaScript . For example :

Call ,Apply and Bind

If I have a method within and object and I want to use it on another object then I can use call(), apply() and bind()

What is Global and Window?

Global : Variables defined outside the functions. And they can be accessed from anywhere inside the function.

What is ‘this’?

‘this’ keyword confuses every developer at any point in their life. Mainly ‘this’ refers to the object it belongs to. Or more clearly, it will contain the value of the context it is running on in the moment. For example,

What is JavaScript Event Loop?

In event loop JavaScript maintains a stack and it executes the stack one after another synchronously. After finishing the stack it then executes asynchronously waiting list works. It can be understood by the diagram below:

JavaScript event loop

What Is Node?

It is a common interview question. And many of as answer it wrong. No Node is not any library. It is a JavaScript runtime environment. Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast and scalable applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.

Show First 10 Values of Fibonacci Series by Recursive Function

function fibonacci(n){

Web Developer, Dreamer, Quick Learner.