Sign in

Learning Consistently — How To Learn, How To Read, Data Structures and Algorithms. Coding Consistently — JavaScript

This is a list of the most common operations performed on Arrays in JavaScript. We will see the usage and their time complexities.

To begin let us consider an array of things I want to own.

const things = ['Books', 'Car', 'Home', 'Money'];

With this list, we will see different operations being performed on arrays.

Lookup (if you know the index)

Look for an item in an array whose index is known. In other words, we can say it is how we access elements from the array.

Time Complexity = O(1)

Arrays or Lists are organized sequentially. They’re stored in contiguous memory. If you need to store some data and iterate over it, arrays are the best choice, especially if you know the indices.

Static & Dynamic Arrays

Static arrays are fixed in size. We need to specify the number of elements in the array while declaring it.

If we want to declare an array of groceries of 7 items, 7 consecutive addresses will be allocated in memory. If we realize later that we need to add one more item we will have to have dynamic arrays.

Dynamic arrays allow us to copy and rebuild…

In real life, we have containers for food (refrigerator), files (folders/file cabinets), toys (packing boxes), or clothes (cupboard). Each container is specific for a thing. We will not put files in packing boxes as they will crumble. It is a way for us to organize our things so we can go back and retrieve them easily.

Similarly, we put data in data structures and retrieve them from the data structures — that is all it is.

Just like in real life, there are tons of data structures in programming as well.

Introduction to Data Structure

A data structure is a collection of values, these…

Function Overloading In Programming Languages

Function overloading means creating multiple functions with different implementations. The rules in function overloading are

  1. The same function name is used for more than one function definition.
  2. The functions must differ by the types of their parameters.

Function Overloading in JavaScript

JavaScript does not support function overloading.

* Display Name
* @param {string} name Name
function displayName(name) {
return `Hi ${name}`;
* Display Name
* @param {string} fName First Name
* @param {string} lName Last Name
* The above function will be overwritten by this function.
function displayName(fName, lName) {
return `Hi ${fName} ${lName}`;
displayName('Ana'); // 'Hi Ana…

This blog gives steps for adding local fonts in your React project.



It is used to specify a custom font with which to display text; the font can be loaded from either a remote server or a locally-installed font on the user’s own computer.


  1. Create a fonts folder in the src folder of the React project.
  2. Add the local font files in the font folder. You can add all the font file formats.
  3. Define the custom fonts using @font-face in the main CSS file. This can be done as follows.

👉 Create a font.css file and put the properties…

The year 2020 has come to an end though, to tell the truth, this year will have a long-lasting impact on us. We are yet to come out of it and get ready to face new challenges. This year my challenge was to keep reading.

In a fantastic video titled BOOKSTORES: How to Read More Books in the Golden Age of Content by Max Joseph I learnt three things

  • You cannot read all the books. It should not intimidate you but remind you how much you don’t know and should inspire you to be selective and read.
  • If you read…

In React keys are unique identifiers.

It helps to identify the items that have changed, or added, or removed. The best way to pick a key is to use a string that uniquely identifies a list item in the lists.

const toDos = => 
<div key={}>

Why do we need keys?

Consider the todo list const todos = ['Make Pancake', 'Read a Book']; It will be rendered in DOM as

<li>Make Pancake</li>
<li>Read a Book</li>

If we add one item at the beginning of the list, the new list is const todos = [’Go to Market’, 'Make Pancake’, 'Read…

The Notion is amazing, to tell the truth, anything that helps us to ease the task of the organization is amazing.

One of the most important features provided by Notion is a toggle.

We know that for better studying we should practice spaced repetition. Toggle helps in effective spaced repetition.

How to use toggle?

Consider you are making notes on a topic let us say World War 1.

World War I, also known as the Great War, began in 1914 after the assassination of Archduke Franz Ferdinand of Austria. His murder catapulted into a war across Europe that lasted until 1918. During the conflict…

This blog summarises the weird relationship between string and mathematical operations in JavaScript. Let us start with a brief on strings in JavaScript. Then in the next section, we will see the relationship of strings with the most common mathematical operators.

Strings in JavaScript

Strings are used to represent and manipulate a set of characters. We can create strings in different ways.

// String Primitive
const string1 = “The quick brown ”;
const string2 = ‘fox jumps over ’;
const string3 = `the lazy dog`;
// String Object
const string4 = new String(‘Some string’);
// Other Examples const string5 = ‘1234567890’; const string6…

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