Articles on Trending Technologies

Technical articles with clear explanations and examples

How to check if a string is html or not using JavaScript?

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 8K+ Views

When working with dynamic HTML content in JavaScript, it's crucial to validate HTML strings before inserting them into the DOM. Invalid HTML can break your webpage structure or cause rendering issues. This article explores two reliable methods to check if a string contains valid HTML using JavaScript. Using Regular Expression to Validate HTML Regular expressions provide a powerful way to match HTML patterns. We can create a regex pattern that identifies valid HTML tags with proper opening and closing structure. Syntax let regexForHTML = /]*>(.*?)/; let isValid = regexForHTML.test(string); Regex Pattern Explanation ...

Read More

JavaScript Program for Reversal algorithm for array rotation

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 335 Views

An array is a linear data structure used to store different types of objects. Given an array of size n and an integer k, we need to rotate the array by k elements to the left and return the rotated array. Rotation means shifting all elements to the left by k positions. Elements that move beyond the first position wrap around to the end of the array. Note − During rotation, when elements shift left, those at the beginning move to the end, creating a circular shift pattern. Let us see an example − Input: ...

Read More

How to create a slider to map a range of values in JavaScript ?

Rohan Singh
Rohan Singh
Updated on 15-Mar-2026 1K+ Views

In JavaScript, mapping a range of values to another range of values can be achieved through various approaches. One common method is by using a slider. A slider allows users to interactively select a value within a specified range and display the mapped value in real-time. In this article, we will explore how to create a slider in JavaScript and map a range of values from (0-100) to (100-10, 000, 000). Steps to create a Slider to map a range of Values in Javascript Step 1: HTML Structure First, we need to set up the HTML structure ...

Read More

How to Convert XML to JSON String in JavaScript?

Pankaj Kumar Bind
Pankaj Kumar Bind
Updated on 15-Mar-2026 2K+ Views

Some popular formats for data exchange are XML (eXtensible Markup Language) and JSON (JavaScript Object Notation). Tags are used to structure XML, while JSON is a more condensed key-value format. In JavaScript apps, converting XML data to JSON is often required to facilitate data manipulation or integration with APIs that expect JSON format. Several techniques for converting XML to JSON using JavaScript are examined in this article, from using DOM parsing to employing custom JavaScript solutions. Understanding XML and JSON XML Example Pankaj 20 ...

Read More

JavaScript Program for Reversal algorithm for right rotation of an array

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 306 Views

Right rotation of an array means shifting elements to the right by a given number of positions. Elements that move beyond the array's end wrap around to the beginning. We'll implement the reversal algorithm, which is an efficient approach for array rotation. Example Input array: [1, 2, 3, 4, 5, 6, 7, 8, 9] Right rotations: 3 Output: [7, 8, 9, 1, 2, 3, 4, 5, 6] How Right Rotation Works Let's trace through 3 right rotations step by step: Original: [1, 2, 3, 4, 5, 6, 7, 8, 9] After 1st ...

Read More

How to create a Responsive Admin Dashboard using HTML CSS & JavaScript ?

Rohan Singh
Rohan Singh
Updated on 15-Mar-2026 10K+ Views

An admin dashboard provides important data insights and controls for managing various aspects of an application or website. In this article, we will explore the process of creating a responsive admin dashboard using the three pillars of web development: HTML, CSS, and JavaScript. Prerequisites To follow this article, you should have a basic understanding of HTML, CSS, and JavaScript. Familiarity with concepts like responsive design, CSS Flexbox, and CSS Grid will also be helpful. Step 1: Setting Up the HTML Structure We'll start by setting up the basic HTML structure for our admin dashboard. Create a ...

Read More

JavaScript Program For Reversing A Linked List In Groups Of Given Size

Prabhdeep Singh
Prabhdeep Singh
Updated on 15-Mar-2026 320 Views

A linked list is a linear data structure that consists of interconnected nodes. Reversing a linked list means changing the order of all its elements. Reversing a linked list in groups of a given size means we divide the list into groups of k nodes and reverse each group individually. Problem Statement Given linked list: 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8 -> null Given group size: 3 Output: 3 -> 2 -> 1 -> 6 -> 5 -> 4 -> 8 -> 7 -> null Explanation: ...

Read More

How to create a Switch in ReactJS?

Rohan Singh
Rohan Singh
Updated on 15-Mar-2026 2K+ Views

ReactJS is a popular JavaScript library for building user interfaces, and it provides an effective approach to developing interactive components. Toggle switches are frequently used to allow users to switch between dark mode and light mode themes in web applications. Toggle switches can also be used to show or hide specific content or sections of a page. In this article, we will explore how to create a toggle switch using ReactJS. Prerequisites Before proceeding with this tutorial, it is assumed that you have a basic understanding of ReactJS and have a development environment set up with Node.js and npm ...

Read More

How to add bootstrap toggle-switch using JavaScript?

Aayush Mohan Sinha
Aayush Mohan Sinha
Updated on 15-Mar-2026 1K+ Views

The Bootstrap library provides a number of features to the user to make their coding experience smooth. One of such features which the user can choose from is the toggle-switch. The toggle-switch, one of its useful features, provides users the ability to add components which can switch between two states such as on and off. Bootstrap Toggle-switch The Cascading Style Sheets (CSS) framework Bootstrap is a toolkit that makes it simpler and more standards-compliant to create websites. It can be used, alongside JavaScript, to create a responsive user interface. The simple Bootstrap toggle-switch component is used to select ...

Read More

How to Count all Child Elements of a Particular Element using JavaScript?

Jaisshree
Jaisshree
Updated on 15-Mar-2026 2K+ Views

Child Node A node that is immediately nested inside another node in a document tree or DOM (Document Object Model) tree is referred to as a child node in JavaScript. Child nodes are specific HTML elements, text nodes, and comment nodes that are nested inside other HTML elements when working with HTML documents. Method 1: Using the childNodes Property The childNodes property returns a NodeList of all child nodes, including text nodes and comments. To count only element nodes, we need to check each node's nodeType property: Example Child 1 Child 2 ...

Read More
Showing 14051–14060 of 61,297 articles
Advertisements