Imran Alam

Imran Alam

52 Articles Published

Articles by Imran Alam

52 articles

Difference between Local Storage, Session Storage, and Cookies in JavaScript

Imran Alam
Imran Alam
Updated on 15-Mar-2026 44K+ Views

JavaScript provides three mechanisms for storing data on the client − cookies, session storage, and local storage. Each one has advantages and disadvantages. Local storage is the most recent mechanism. It allows for larger amounts of data to be stored, but the data is not deleted when the browser is closed. Local storage is useful for storing data that the user will need to access later, such as offline data. Session storage is similar to cookies, but the data is only stored for the current session. This means that the data will be deleted when the user closes ...

Read More

How to find the sum of all elements of a given array in JavaScript?

Imran Alam
Imran Alam
Updated on 15-Mar-2026 1K+ Views

In JavaScript, finding the sum of all elements in an array is a common operation. This tutorial covers different methods to achieve this, from traditional loops to modern array methods. Using the for Loop The for loop is the most straightforward approach to sum array elements. It provides full control over the iteration process and is easy to understand. Example Sum Array Elements Finding sum using for loop: ...

Read More

JavaScript: How to remove the key-value pairs corresponding to the given keys from an object?

Imran Alam
Imran Alam
Updated on 15-Mar-2026 12K+ Views

In JavaScript, objects store data as key-value pairs. You can access object data using dot notation (obj.key) or bracket notation (obj["key"]). Sometimes you need to remove specific key-value pairs from an object. Here are three effective methods to accomplish this. Using the delete Operator The delete operator is the most straightforward way to remove a property from an object. It permanently removes both the key and its value. Delete Operator Example ...

Read More

How to create a moving div using JavaScript?

Imran Alam
Imran Alam
Updated on 15-Mar-2026 12K+ Views

A moving div is a web page element that can be animated to move across the screen by modifying its position properties. Creating a moving div using JavaScript requires HTML for structure, CSS for positioning, and JavaScript for the animation logic. In this tutorial, we will learn how to create a moving div using JavaScript. HTML Structure First, we need a div element with a unique ID that we can target with JavaScript: This is my moving div! CSS Styling The CSS sets the initial position and appearance. We use position: relative to ...

Read More

How to Create a Currency Converter in JavaScript?

Imran Alam
Imran Alam
Updated on 15-Mar-2026 10K+ Views

In this tutorial, we will be discussing how to create a currency converter in JavaScript. We will be discussing the various steps involved in creating such a converter. What is a Currency Converter? A currency converter is a tool that helps you convert one currency to another. For example, if you are from the United States and you are traveling to Europe, you will need to use a currency converter to convert your US dollars into Euros. Why Use JavaScript to Create a Currency Converter? JavaScript is a versatile programming language that can be used to ...

Read More

How to check if a value is object-like in JavaScript?

Imran Alam
Imran Alam
Updated on 15-Mar-2026 279 Views

In JavaScript, an object-like value is any non-primitive value that has a type of "object". This includes objects, arrays, dates, and regular expressions, but excludes primitives like strings, numbers, booleans, null, and undefined. Understanding how to identify object-like values is crucial for data validation and type checking. What Makes a Value Object-Like? Object-like values share these characteristics: They are not primitive types (string, number, boolean, null, undefined, symbol) They can hold properties and methods They are reference types, not value types Method 1: Using the typeof ...

Read More

Design a Digital Clock in Neumorphism Style using JavaScript

Imran Alam
Imran Alam
Updated on 15-Mar-2026 508 Views

In this tutorial, we will be discussing how to design a digital clock in neumorphism style using JavaScript. Neumorphism is a design trend characterized by soft, raised elements with subtle shadows that create an embossed or pressed effect on the interface. HTML Structure Let's start by creating the basic HTML structure for our neumorphic digital clock. We need a container for the clock and display elements. Neumorphic Digital Clock ...

Read More

Difference between location.host and location.hostname in JavaScript

Imran Alam
Imran Alam
Updated on 15-Mar-2026 4K+ Views

JavaScript's Location object provides access to the current URL's components. One can think of this object as a read-only window into the current location. There are two properties of the Location object that are often confused: location.host and location.hostname. Let's explore their differences with practical examples. location.host The host property returns the hostname and port number (if specified) of the current URL. Location Host Example Current URL Host Information ...

Read More

How to create a chessboard pattern with JavaScript and DOM?

Imran Alam
Imran Alam
Updated on 15-Mar-2026 6K+ Views

Creating visual patterns with JavaScript and DOM manipulation is a great way to understand programming logic. In this tutorial, we'll create a classic chessboard pattern using JavaScript to dynamically generate alternating colored squares. Algorithm Overview The chessboard pattern relies on a simple mathematical principle: if the sum of row and column indices is even, the square is one color (black), otherwise it's another color (white). This creates the alternating pattern characteristic of a chessboard. Basic Implementation Here's how to create a chessboard pattern step by step: Create a container div for the chessboard Use ...

Read More

How to Create Fullscreen API using JavaScript?

Imran Alam
Imran Alam
Updated on 15-Mar-2026 1K+ Views

The Fullscreen API is a browser API that allows developers to request fullscreen display from the user, and to exit fullscreen when desired. Using the Fullscreen API is relatively simple. First, you must check if the browser you are using supports the Fullscreen API. You can do this by checking for the presence of the requestFullscreen method on any element. If the browser does not support the Fullscreen API, you can still provide a fullscreen experience to your users by using another method, such as opening a new browser window. The function that requests full screen display ...

Read More
Showing 1–10 of 52 articles
« Prev 1 2 3 4 5 6 Next »
Advertisements