Objects in JavaScript

An object in JavaScript (and perhaps in all other programming languages), is a collection of key-value pairs. Where key is the identifier and value is the value for that key. A simple object: There are other ways of creating an object, but this is the simplest version. This is also called the object literal notation.

Read More


Closure – II

Let us see another famous and good example for understanding the concept of closure. A prior knowledge of how callbacks and event loop work in JavaScript is required. setTimeout is not a native function in JavaScript. It is an API similar to XMLHttpRequest which enables us to extend JavaScript to asynchronous in nature. setTimeout is a

Read More


Closure – I

The closure “was” and has been one of the most interesting and important concepts of Javascript. I have written “was” because, now that most of the “new” developers are using ES6 and maybe ES7, they might never come across the concept of what closure is and its usage. For those who are or end up

Read More


React Components

Components are small, isolated, and reusable parts of UI. Technically, a component is a JavaScript function which takes an input [called props] and returns a React element (JSX). For example: We can also extend React’s Component class to create a class based components, which has some additional features when compared to a function based component.

Read More


Virtual DOM

A Virtual DOM (VDOM) is a concept of displaying UI elements on the webpage without coupling them with the Real DOM (DOM). It is a lightweight JavaScript object, a tree structure similar to the DOM. Using libraries like ReactDOM, we align and display the VDOM on the page; which mounts the entire VDOM on a

Read More


DOM and The Web Page

A concise introduction of how the browser displays a web page. Document Object Model (DOM) is an interface which treats the HTML (or XHTML/XML) as a tree structure. The node of this tree represents an HTML element. The process of rendering a page on the web browser involves many steps. Simply speaking, when we type

Read More


Observer Pattern

According to the GoF book, Design Patterns: Elements of Reusable Object-Oriented Software, the definition of Observer Pattern is: “One or more observers are interested in the state of a subject and register their interest with the subject by attaching themselves. When something changes in our subject that the observer may be interested in, a notify

Read More