We hear this a lot, everything is object is in JavaScript, okay, well, how you saying that ? how to prove everything (like function, array, class and variables) is Object in JavaScript ? Let’s get started with simple example.

Open your favourite browser (mine is Chrome) open inspect window(ctrl+shift+i is the shorcut on windows) and click on console. And create an array like the screenshot shown below.

Observe the Image carefully, we just created an array named arr and in the next line if we type arr followed by a “.” …

Let’s discuss one interesting JavaScript topic today. Even beginners of JavaScript will be aware of array and adding and removing values from it. But most of us do not try to understand internal implementation of all array functions (Sometimes it is not possible also, to understand implementation of every function !!).

So today let us discuss about array.push method. If your are not aware, how array.push works then here is the official link for it.

Source — Wikipedia

Let’s start with easy example: Can you guess the output of below snippet?

let arr = [];
let x = 10;
x = 20;

In JavaScript it’s quite annoying sometimes when you’re not aware of how things work, you start scratching your head but you will not find solution to it. In this article I’m going to discuss one interesting problem of that kind. This article is based on async and await.

What are async and await?

In simple words they are syntactic sugars for promise nesting. In case you’re not aware of it, read my article that explains async and await here.

Assuming you have read above article and know what is async and await let’s take up a simple example.

async function foo() {

If you directly landed upon this article, then before reading any further, read my previous article on how to implement linked lists in JavaScript here.

I assume that you have read my previous articles about linked lists and you’re aware of how to perform basic operations on a linked list in JavaScript.


Find the nth last element in a given singly linked list.

For example: [1,2,3,4,5,6] is a linked list then the 2nd last element is 5, 4th last element is 3.

Solution 1 — Not recommended

Iterate the Linked list and copy elements into an array, then display…

If you have landed on this page, most likely you know what is async and await and at some point in time you might have got this question in your mind are they really blocking JavaScript main thread ?

What are async and await ?

I believe most of your aware of it, for those of you who are not clear, here is the quick explanation.

Let’s say you want to make an API call using promise, and response of that API call has to be passed to another promise and again response of that promise you want to transfer…

It’s known to all how React Native is becoming the go-to framework for developing Android and iOS applications.

In the initial days, just the startups and POC projects were being developed in React Native, and eventually, the big players like Swiggy, Flipkart, Walmart, etc, adopted it. With larger adoption, it is very important to handle security aspects. Below are the few primary aspects of security that every React Native application must follow.

  1. Storing user details: It is very important for every application to store some user details like AUTH token, user name, email, etc. in the device storage. Whenever you’re…

Most of you might have an idea what are pure functions, in-fact initially I had no intention of writing an article regarding this topic as it is very straight forward. But in an interview I was asked multiple variants of the pure function and I was unable to answer. So thought of writing a detailed explanation which would help audience.

What are pure functions?

In simple words these are the functions whose output strictly depends upon the input passed and there are no side effect. For ex: consider below example to calculate the area of square.

function areaOfSquare(length, breadth){
return length…

If you directly landed upon this article, then before reading any further, read my previous article on how to implement linked lists in JavaScript here.

How to reverse a linked list in JavaScript

Sample input and output

Input 1 = 10–> 20 -> 30 -> 40 -> Null

Output 1 = 40 -> 30 -> 20 → 10 -> null

Input 2 = Null

Output 2 = null

This is one of the very common question asked in most of the interviews. …

Photo by Arif Riyanto on Unsplash

If you directly landed upon this article, then before reading any further, read my previous article on how to implement linked lists in JavaScript here.

I assume you have read my previous articles on linked lists and you know how linked lists work in JavaScript. And that you also know how to implement the basic operations of linked lists like adding a node, printing the list, etc, in JavaScript.

Now let us start with some advanced questions. I have decided to discuss 1–2 questions in each post, so that users are not overwhelmed.

Question 1:

Find the middle element in…

If you directly landed on to this article, then before reading further, read my previous article on how to implement Linked List in JavaScript here.

Assuming you have read my previous article above, you also know that everything is object in JavaScript. Hence, even the Linked List has to be an object. Unlike strongly typed languages like Java, C, C++ which will interact with system memory directly, JavaScript doesn’t interact with system memory; instead, it is fed as a language to an underlying compiler and they will execute the JavaScript code on our behalf and return the result.

Data Structures…

Vasanth Bhat

React Native developer with JavaScript fan. Overall 5 years of Software Experience. Coffee lover, likes travelling and writing.

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