Image for post
Image for post
Photo by David Adamson on Unsplash

In this article, we will discuss debouncing and throttling techniques that can not only enhance the performance of your website, but also prevent unnecessary API calls and load on the server.

Debouncing and throttling techniques are used to limit the number of times a function can execute. Generally, how many times or when a function will be executed is decided by the developer. But in some cases, developers give this ability to the users. Now, it is up to the user to decide when and how many times to execute that function.

For instance, functions attached to events like button…

Web Share APIs use the device’s native sharing capabilities to share any web site content. — Learn all about it.

Image for post
Image for post
Photo by Saulo Mohana on Unsplash

With each passing day, new technologies are bridging the gap between web apps and native apps (apps that are installed on your device like WhatsApp). One such example is Progressive Web Applications that have added many native app-like features to the web like push notifications. In this article, we will discuss Web Share API which allows web apps to use the same share dialog box that a native app uses to share content.

Web Share APIs were first introduced in Chrome 61 for Android so that the users can use the devices’ native capabilities to share web apps. At present…

A detailed walk-through of all the core components that are involved in the execution of JavaScript code

Image for post
Image for post
Photo by Bram Naus on Unsplash

In this article, we will discuss the internal working of JavaScript in the run-time environment and the browser. This will be a detailed walk-through of all the core components that are involved in the execution of JavaScript code. We will discuss the following components:

  1. JavaScript Engine
  2. JavaScript Runtime Environment
  3. Event loop, Event Table and Callback Queue or Message Queue
  4. setTimeout function internal working

Let’s begin with the JavaScript engine.

A small tip before we begin: Use Bit (Github) to turn your JS code into reusable and shareable components — start coding better and faster.

JavaScript Engine

JavaScript engines are inbuilt in all…

Image for post
Image for post
Photo by Pankaj Patel on Unsplash

In this post, we will discuss what is execution context and scope chain in JavaScript. We will also check the internal working of JavaScript step by step. Understanding these concepts will not only help in understanding the JavaScript internals but also other concepts like hoisting and closure.

Execution context (EC) is defined as the environment in which the JavaScript code is executed. By environment, I mean the value of this, variables, objects, and functions JavaScript code has access to at a particular time.

Execution context in JavaScript is of three types as:

  1. Global execution context (GEC): This is the default…

The Object.create method is one of the methods to create a new object in JavaScript.

Other methods of creating objects in JavaScript are described in my previous article. I recommend reading my previous articles on Understanding Prototypes and Inheritance to get the best out of this article.

Basic syntax:

Object.create(prototype_object, propertiesObject)

Object.create method accepts two arguments as:

  1. prototypeObject: Newly created object’s prototype object. It has to be an object or null.
  2. propertiesObject: Properties of the new object. This argument is optional

Create an object with Object.create with no prototype

Consider the below example to create a new object in JavaScript

Creating new lists from other iterables

List comprehensions are used for creating new lists from other iterables.

As list comprehensions return lists, they consist of brackets containing the expression, which is executed for each element along with the for loop to iterate over each element.

This is the basic syntax:

new_list = [expression for_loop_one_or_more conditions]

For example, find the squares of a number using the for loop:

Finding squares using list comprehensions:

Here, square brackets signify that the output is a list. n**2 is the expression executed for each element and for n in numbers is used to iterate over each element. …

Image for post
Image for post
Photo by Fatos Bytyqi on Unsplash

In this article, we will have a detailed discussion on function and class decorators in Python. We will begin with understanding functions in Python and later with the help of examples, we will understand the internal working of decorators.

Functions in Python

In Python, everything is an object. Not only complex datatypes like list or dict but even simple data types like int, float, etc are objects in Python. Functions in Python are also objects. They are considered as the first-class object.

First-class objects in a programming language are entities that behave just like normal objects. They can be referenced by variables, stored…

In this post, we will discuss what is virtual DOM, how it has helped ReactJS in making DOM manipulation efficient.

ReactJS does not update the real DOM directly but it updates the Virtual DOM. DOM stands for Document Object Model. As per DOM defines the logical structure of documents and the way a document is accessed and manipulated.

This causes a great performance benefit for ReactJS. Here, we will try to understand why updating the real DOM is slow and how updating Virtual DOM increase the performance?

Why updating Real DOM is slow:

Updating a DOM is not slow…

Lists in Python can be concatenated in two ways

  1. Using + operator
  2. Using extend

Let list_a and list_b be defined as below

list_a = [1, 2, 3, 4]
list_b = [5, 6, 7, 8]

Using + operator to concatenate two list_a and list_b

list_c = list_a + lis_b 
print list_c # Output: [1, 2, 3, 4, 5, 6, 7, 8]

If we do not want a new list i.e. list_c

list_a = list_a + list_b
print list_a # Output: [1, 2, 3, 4, 5, 6, 7, 8]

Using extend

extend operator can be used to concatenate one list into another…

Rupesh Mishra

Backend Developer | Freelance Blogger

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store