Don’t be afraid of JavaScript Interview Question, so follow

In this article we will discuss some core costing related to JavaScript interview and how to get out of it. So let’s get started

1. What is the difference between double equal (==) vs triple equal (===)?

Double equal(==) is checking value but Triple equal(===) checking value and data type. Double equal is not stricter but triple equal is very stricter for value.

2.What is the difference between call, apply and bind in JS?

In JavaScript, the prototype of each function points to Function.prototype Object (JS is based on the inheritance of the prototype chain). Therefore, each function has apply, call, and bind methods, which inherit from the function.
They have the same function, they are used to change the direction of this in the function. The difference between call, apply and bind is already clear.

3.What is window, global variable, global scope?

a window is an object. but it is not a normal object. Javascript all property value has inside the window object. In general, we are use console.log, documents.getElementById and etc. all are coming from window objects. a window object is a global object. so we don’t need to write window.console.log, window.getElementById. then propertyName is a global scope variable. and another hand local scope. local scope is accessed from his own function. otherwise, return an error.

4.What is JavaScript event loop?

JavaScript event loop means how the JavaScript environment works. JavaScript works synchronously. synchronously means JavaScript executes code serially one by one. but when we use the set timeout function. it is works differently asynchronous way. The first JavaScript code engine executes code one by one. When we JavaScript function call and this function call another function thus many function stacks one on the top of the other. It gets output on the top stack. Then it has many times and it keeps waiting on the stack and queue. When the set timeout is waiting to get ready it is in a reserve queue. It clears stack work then calls a data queue.

5.What is DOM?

DOM is a programmatic representation of a web page. A web page is made of different types of HTML elements. DOM builds a tree-like structure using these nodes where some nodes are parents, and other nodes are children

6.What is Functional Programming?

Functional programming has become a really hot topic in the JavaScript world. Just a few years ago, few JavaScript programmers even knew what functional programming is, but every large application codebase I’ve seen in the past 1 years makes heavy use of functional programming ideas.

Functional code tends to be more concise, more predictable, and easier to test than imperative or object oriented code — but if you’re unfamiliar with it and the common patterns associated with it, functional code can also seem a lot more dense, and the related literature can be impenetrable to newcomers. There are a lot of ideas in the innocent looking definition above which all need to be understood before you can begin to grasp the meaning of functional programming:

  • Pure functions
  • Function composition
  • Avoid shared state
  • Avoid mutating state
  • Avoid side effects

7.What is a Promise?

A promise may be in one of 3 possible states: fulfilled, rejected, or pending. Promise users can attach callbacks to handle the fulfilled value or the reason for rejection.Promises are eager, meaning that a promise will start doing whatever task you give it as soon as the promise constructor is invoked

A promise is an object which can be returned synchronously from an asynchronous function. It will be in one of 3 possible states:

  • Fulfilled: onFulfilled() will be called (e.g., resolve() was called)
  • Rejected: onRejected() will be called (e.g., reject() was called)
  • Pending: not yet fulfilled or rejected

8.What is a Closure?

Closures are important because they control what is and isn’t in scope in a particular function, along with which variables are shared between sibling functions in the same containing scope.A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment).

9.What is event bubble?

When an event is in an element within another element and all elements have registered a handle to that event, event bubbling is a form of event propagation in the HTML DOM API. It’s a process that begins with the element that caused the event and then moves up the hierarchy to the containing elements. The event is first captured and treated by the innermost element in event bubbling.

10.What is Prototypal Inheritance?

Prototypal inheritance is a foundational, powerful, and oft misunderstood concept to JavaScript. When you create a function in JavaScript, it will always have a prototype property. (Functions can have properties because they are, in fact, objects).

--

--

Nishat Ahmed ::::: Programming Zone

I am Dewan Nishat Ahmed from Dhaka, Bangladesh . I am a Web Developer and content writter & Blogger.