DEV Community

Mahamud Pino
Mahamud Pino

Posted on

JavaScript

Double equal (==) vs triple equal (===):

Double equal (==) just compare values and triple equal (===) compare values and types.

Example:
Image description

Here this code number and StringNumber look similar. Here values are the same but type is not the same for this reason, when just checking values it returns true but when checking values and types it returns false.

What is an API, the purpose of API, GET, POST:

API means data connection from one software product to another one. Sometimes in our projects we use api. We collect data from the internet and sometimes we also send some data to reuse in future.
Get is used to request data from a specified resource.
Post is used to send data to a server to create or update a resource.

Scope, block scope, window, global variable, global scope:

Scope determines the visibility or accessibility of a variable or other resource in the area of your code.
Block scope: A variable when declared inside the if or switch conditions or inside for or while loops, are accessible within that particular condition or loop.
Global scope: The variable can be accessed from any part of the code.

Closure:

The combination of a function bundled together (enclosed) with references to its lexical environment surrounding state.
Closures are created every time a function is created, at function creation time. To use a closure, define a function inside another function and expose it. The inner function will have access to the variables in the outer function scope, even after the outer function has returned

Prototype chain:

In JavaScript every object has a private property which holds a link to another object called its prototype. That prototype object has a prototype of its own, and so on until an object is reached with null as its prototype. By definition, null has no prototype, and acts as the final link in this prototype chain.

Bind, call and apply:

Bind, call and apply are three important functions in javaScript.
Bind creates a function.
Call and apply call a function.
Call method pass arguments individually and apply method as an argument array.

Event bubble, Event delegate and purpose of Event bubble:

A method where JavaScript allows DOM elements to be nested inside each other. In such a case, if the handler of the child is clicked, the handler of the parent will also work as if it were clicked too.

Top comments (0)