Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
How to check if a string is html or not using JavaScript?
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 MoreJavaScript Program for Reversal algorithm for array rotation
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 MoreHow to create a slider to map a range of values in JavaScript ?
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 MoreHow to Convert XML to JSON String in JavaScript?
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 MoreJavaScript Program for Reversal algorithm for right rotation of an array
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 MoreHow to create a Responsive Admin Dashboard using HTML CSS & JavaScript ?
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 MoreJavaScript Program For Reversing A Linked List In Groups Of Given Size
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 MoreHow to create a Switch in ReactJS?
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 MoreHow to add bootstrap toggle-switch using JavaScript?
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 MoreHow to Count all Child Elements of a Particular Element using JavaScript?
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