Web Development Articles

Page 133 of 801

How to Send Axios Delete to the Backend ReactJS in JavaScript

Nikesh Jagsish Malik
Nikesh Jagsish Malik
Updated on 15-Mar-2026 4K+ Views

Sending DELETE requests to a backend is a common requirement in React applications. Axios provides multiple ways to handle DELETE operations, making it easy to remove data from your server. What is Axios DELETE? Axios DELETE is an HTTP method used to remove resources from a server. In React applications, you'll typically use it to delete user records, posts, comments, or any other data that needs to be removed from your backend database. Algorithm Here are the steps to send an Axios DELETE request in React: Import Axios − Include the Axios library in ...

Read More

How to concatenate regex literals in JavaScript?

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

Regular expressions (regex literals) are patterns used to match character combinations in strings. Sometimes, you need to combine multiple regex patterns into a single expression. Unlike strings, regex literals cannot be concatenated directly with the '+' operator. To concatenate regex literals, you must extract their source patterns and flags, combine them properly, and create a new RegExp object. Syntax Follow this approach to concatenate regex literals: let allFlags = regex1.flags + regex2.flags; let uniqueFlags = [...new Set(allFlags.split(''))].join(''); let combined = new RegExp(regex1.source + regex2.source, uniqueFlags); This extracts the source patterns and flags from ...

Read More

Find the OR and AND of Array elements using JavaScript

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 203 Views

In JavaScript, we can use the '&&' operator to perform the AND operation between two elements and the '||' operator to perform OR operation between two elements. Here, we will learn to perform OR and AND operations between every element of the array using different approaches. Use the for Loop We can use the for loop to iterate through the array elements and perform OR or AND operations with all array elements. Syntax Users can follow the syntax below to use the for loop to take OR or AND operation of every element. ...

Read More

Finding the time elapsed in JavaScript

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

Finding time elapsed in JavaScript is essential for performance monitoring, measuring execution time, and tracking user interactions. JavaScript provides several built-in methods to calculate time differences accurately. In this tutorial, we'll explore three different approaches: the Date() object for general time calculations, console.time() for debugging, and performance.now() for high-precision measurements. Using the Date() Object The Date() constructor returns the current timestamp in milliseconds since January 1, 1970 (Unix epoch). We can calculate elapsed time by finding the difference between two timestamps. Syntax let startTime = new Date(); let endTime = new Date(); let timeElapsed ...

Read More

How to create an id using mongoose in Javascript?

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

In this tutorial, we will learn to create an id using mongoose in JavaScript. Users can use the Mongoose NPM package in NodeJS to use MongoDB with NodeJS or connect MongoDB with the application. While storing the data in the MongoDB database, we must add a unique id to every data collection. However, if we don't add an id, it generates automatically and adds to the data. Syntax Users can follow the syntax below to create an id using mongoose in JavaScript. var newId = new mongoose.mongo.ObjectId(); In the above syntax, we access ...

Read More

How Do You Make An If Statement In JavaScript That Checks If A Variable is Equal To A Certain Word?

Yaswanth Varma
Yaswanth Varma
Updated on 15-Mar-2026 572 Views

In JavaScript, you can use an if statement to check if a variable equals a specific word using the equality operator (==) or strict equality operator (===). What is an if...else Statement An if statement executes a block of code when a condition is true. The else block runs if the condition is false. This is a fundamental conditional statement in JavaScript. Syntax if (condition) { // code executes if condition is true } else { // code executes if condition is false } Basic String Comparison ...

Read More

How to Get the Content of an HTML Comment Using JavaScript

Yaswanth Varma
Yaswanth Varma
Updated on 15-Mar-2026 780 Views

HTML comments are pieces of code that web browsers ignore. They're used to add notes and documentation to HTML code, making it easier to understand and maintain. Comments are written between tags. While browsers ignore comments during rendering, JavaScript can access and extract their content using various string manipulation methods. Syntax HTML comments follow this syntax: Method 1: Using replaceAll() Method The replaceAll() method can remove comment tags to extract the inner content: ...

Read More

JavaScript Program for Search an element in a sorted and rotated array

Aishwarya Mani Tripathi
Aishwarya Mani Tripathi
Updated on 15-Mar-2026 446 Views

When an array is sorted in ascending order and then rotated by some pivot point, it becomes challenging to search for an element using traditional search algorithms. As a developer, you need to find an efficient solution to this problem. In this article, we will guide you through the process of writing a JavaScript program to search for an element in a sorted and rotated array. We will explain the underlying logic and provide you with a step-by-step approach to implementing this program. Problem Statement Before we begin, let's understand the problem statement. We have a sorted ...

Read More

JavaScript Program for Rotate the matrix right by K times

Aishwarya Mani Tripathi
Aishwarya Mani Tripathi
Updated on 15-Mar-2026 339 Views

The term "perform right rotation on a matrix" refers to shifting each column in the matrix to the right. This operation is repeated "k" times when specified. In other words, it's a right shift of the matrix that occurs "k" times. This program can be implemented using various programming languages but a simple yet effective approach is to consider JavaScript for rotating the matrix right by k times. How to rotate the matrix right by K times? It is straightforward to carry out a right rotation on a matrix by k times, which involves shifting each column of ...

Read More

How to Detect if An \'IMG\' Element Load Has Started And/or a Request Has Been Made to the Server?

Yaswanth Varma
Yaswanth Varma
Updated on 15-Mar-2026 491 Views

Sometimes when inserting images into HTML sites, the image may not load for the following reasons: Incorrect image URL Network connectivity issues Server downtime or slow response Detecting if an IMG element load has started and/or a request has been made to the server is crucial for handling loading states and providing better user experience. Let's explore different methods to achieve this. HTML Tag Overview The HTML tag is used to embed images in web pages. It creates a holding space for the ...

Read More
Showing 1321–1330 of 8,010 articles
« Prev 1 131 132 133 134 135 801 Next »
Advertisements