Web Development Articles

Page 286 of 801

How to Flatten JavaScript objects into a single-depth Object?

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

In JavaScript, flattening an object means converting a nested object structure into a single-depth object where all nested properties are brought to the top level with flattened key names. What is Object Flattening? Object flattening transforms a multi-level nested object into a flat structure. For example, an object like {a: 1, b: {c: 2, d: 3}} becomes {a: 1, "b.c": 2, "b.d": 3} or {a: 1, c: 2, d: 3} depending on the flattening strategy. Method 1: Simple Flattening (Merging Properties) This approach merges nested properties directly into the parent object: ...

Read More

How to unflatten an object with the paths for keys in JavaScript?

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

In JavaScript, unflattening an object means converting a flattened object (where nested properties are represented as dot-separated keys) back to its original nested structure. This is commonly needed when working with APIs, databases, or form data that store nested objects as flat key-value pairs. What is a Flattened Object? A flattened object has nested properties represented as string keys with dot notation: // Flattened object var flatObj = { "user.name": "John", "user.age": 30, "user.address.city": "New York", "user.address.zip": "10001" }; Basic Unflattening Algorithm ...

Read More

What are Architecture Flux Components in JavaScript?

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

Flux is a JavaScript application architecture pattern developed by Facebook for building scalable web applications. Originally designed for React applications, Flux provides a unidirectional data flow pattern that makes application state more predictable and easier to debug. The Flux architecture consists of four main components that work together to manage data flow in a predictable way. Core Flux Components Flux architecture is built around four key components that ensure unidirectional data flow: Actions − Plain JavaScript objects that describe what happened in the application Dispatcher − Central ...

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

Why split the tag when writing it with document.write()?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 1K+ Views

In this tutorial, we will learn why to split the tag when writing it with the document.write(). The script tag in HTML is added to execute JavaScript code on the webpage. The JavaScript programs must be enclosed with the script tag to execute. There are many methods in JavaScript that add HTML content to the page, like the document.write() method. The document.write() method is used to delete all the content from the HTML tag or the document and add the content specified in this method to the page. Because of performance degradation and errors in certain conditions, ...

Read More

How to add fade-in effect using pure JavaScript?

Diksha Patro
Diksha Patro
Updated on 15-Mar-2026 7K+ Views

Introduction We use the fade effect to bring attention to certain parts of our website by gradually increasing or decreasing their opacity. This gradual change in opacity is called the fade-in or fade-out effect. When we gradually increase the opacity, it's known as the fade-in effect and is used to make the selected part of the page become more visible over a chosen amount of time. This creates a smooth transition and helps make our website more dynamic and engaging for our users. In this article, we will be exploring two ways in which we can implement the ...

Read More

How can a particular frame be targeted, from a hyperlink, in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 662 Views

HTML frames provide a convenient way to divide a browser window into multiple sections, where each section can load a separate HTML document. JavaScript allows you to target and manipulate specific frames using several methods through the window.frames property and DOM manipulation. The frames property is an array-like object containing all the frames (including iframes) on the current page. Here are the main approaches to target a particular frame: Method 1: Using Frame Index You can target a specific frame by its index position in the frames collection. The first frame has index 0: // ...

Read More

How to accept all pending connection requests on LinkedIn using JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 687 Views

To accept all pending connection requests on LinkedIn using JavaScript, you would need to use the LinkedIn API and an automation tool. The script would need to navigate to the connection request page and loop through each request, clicking the accept button for each one. This is a very common issue for people who are moderately to highly active on LinkedIn. They get many connection requests every day and must manually click on accept against each request to actually accept them. You can, however make use of JavaScript and the window console to automate this whole process and ...

Read More

How to Access element from Table using JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 13K+ Views

To access table elements using JavaScript, you can use methods like document.getElementById() or document.getElementsByTagName() to select the table, then access individual rows and cells. This article demonstrates how to access table rows and create an interactive hover effect. Basic Table Access Methods JavaScript provides several ways to access table elements: By ID: document.getElementById('tableId') - Access a specific table By Tag Name: document.getElementsByTagName('tr') - Access all table rows Table Properties: Use table.rows or table.childNodes to access rows Example: Interactive Table with Hover Effect Let's create a table where rows highlight when you hover over ...

Read More

How to implement multiple input checkbox in vanilla JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 950 Views

We will learn how to implement multiple input checkbox functionality in vanilla JavaScript. The checkbox input selector will have the following features: Multiple options can be selected using checkboxes Chosen options will be displayed as a separate list with visual indicators Delete icon will be provided against each chosen option to uncheck/remove that option We will implement this functionality using only HTML, CSS, and JavaScript without any third-party libraries. Approach Create an object where keys represent checkbox labels and values (true/false) ...

Read More
Showing 2851–2860 of 8,010 articles
« Prev 1 284 285 286 287 288 801 Next »
Advertisements