Web Development Articles

Page 123 of 801

JavaScript Program for Block Swap Algorithm for Array Rotation

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 506 Views

To implement block swap algorithm for array rotation, we will be understanding two different approaches. Rotation of the array elements means moving the elements of the given array to either the left or right side by some number of specific positions. Block swap algorithm for array rotation means to rotate the elements of the array by a given number but not using the rotation but the swapping technique. In this article we are having an array and a variable d by which array will be rotated, our task is to write a JavaScript program for block swap algorithm for ...

Read More

JavaScript Program to Check if Matrix is Upper Triangular

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 349 Views

To check if matrix is upper triangular matrix, we check if all the elements below the main diagonal is 0. We are going to discuss two different approaches and compare their complexities. In this article we are having a 2D square matrix, our task is to write a JavaScript program to check if matrix is upper triangular matrix. Users must be familiar with upper triangular matrix, nested for loop, conditional statement and javascript methods. ...

Read More

JavaScript Algorithms: Sorting, Searching, and Graph Traversal

Mukul Latiyan
Mukul Latiyan
Updated on 15-Mar-2026 830 Views

JavaScript is a versatile programming language widely used for web development. While it is known for its ability to enhance the interactivity of web pages, JavaScript also provides powerful algorithms for sorting, searching, and graph traversal. These algorithms are essential in solving complex problems efficiently. In this article, we will explore advanced JavaScript algorithms, including sorting algorithms like quicksort and mergesort, searching algorithms like binary search, and graph traversal algorithms like breadth-first search and depth-first search. Sorting Algorithms Sorting algorithms play a crucial role in organizing data in a specific order. JavaScript offers several efficient sorting algorithms, two ...

Read More

How to splice an array without mutating the original Array?

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

In JavaScript, the splice() method modifies the original array by adding, removing, or replacing elements. However, sometimes you need to perform splice operations without changing the original array. This tutorial demonstrates three effective approaches to splice arrays while preserving the original data. Understanding the splice() Method The splice() method changes the contents of an array by removing or replacing existing elements and/or adding new elements in place. Syntax array.splice(startIndex, deleteCount, item1, item2, ..., itemN) Parameters startIndex − The index at which to start changing the array deleteCount − The number of ...

Read More

How to trigger the HTML button after hitting enter button in the textbox using JavaScript?

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

Generally, developers add the submit button to submit the input field's text. However, if they allow users to submit the input value by pressing enter, it improves the UX of the application. Here, we will learn the general way to detect the key press using the key listener event. Afterwards, we can perform any operation whenever the user presses the enter key button. Syntax Users can follow the syntax below to detect whenever the user presses the enter key. input.addEventListener("keypress", function (event) { if (event.keyCode == 13) { ...

Read More

How to trigger the onchange event on input type=range while dragging in Firefox?

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

The range input allows users to select any value within a specified range. By default, the onchange event only triggers when the user releases the mouse, not during dragging. This creates poor user experience as users can't see real-time value updates. The onchange event triggers only when the user releases the mouse button, so it won't update the value while dragging the range slider. This behavior occurs in all browsers, including Firefox, Chrome, and Safari. Let's examine this problem and explore the solution using the oninput event. Problem: onchange Event Limitation In this example, the range ...

Read More

How to trigger the setInterval loop immediately using JavaScript?

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

The setInterval() method allows us to continuously trigger a callback function after every particular time period. We can pass the callback function as the first parameter to trigger after every time period, and the time period in milliseconds as a second parameter. The setInterval() method invokes the callback function after a particular number of milliseconds for the first time. Now, the problem is we need to invoke the callback function instantly for the first time at 0 milliseconds, and after that, we need to invoke it continuously in the given time period. The Default Behavior Problem In ...

Read More

How to check if CSS property is supported in browser using JavaScript?

Aman Gupta
Aman Gupta
Updated on 15-Mar-2026 2K+ Views

CSS properties aren't supported uniformly across all browsers. JavaScript's CSS.supports() method lets you check if a specific CSS property and value combination is supported by the current browser, preventing layout issues and enabling feature detection. Syntax CSS.supports("property: value"); CSS.supports("property", "value"); Parameters property − The CSS property name (e.g., "display", "grid-template-columns", "backdrop-filter") value − The property value to test (e.g., "flex", "repeat(3, 1fr)", "blur(5px)") Return Value Returns true if the browser supports the property-value combination, false otherwise. Method 1: Direct Property Testing Test specific CSS ...

Read More

How to use Ejs in JavaScript?

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

EJS is a templating language that allows us to generate HTML markup using plain JavaScript. It provides a simple and intuitive way to generate dynamic content in our web applications, making it easier to manage and organize our code. EJS is easy to use and can be integrated into any JavaScript project with just a few steps. In this tutorial, we will learn the basics of how to use EJS in JavaScript, including how to set up our project, create an EJS template, and render the template to generate dynamic HTML output. Steps to Use EJS in a ...

Read More

How to use SolverJS?

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 271 Views

SolverJS is a comprehensive JavaScript package that provides a range of functions to help us solve common math problems. We know that web applications often require complex logic to function properly, and these logical solutions can easily become long and difficult to manage. This is where Solver JS comes in - it includes a wide range of general and complex mathematical solutions and provides functions not available in standard JavaScript. In this tutorial, we will learn how to use Solver JS and its various functions. The package includes functions such as date conversions, keyword extraction, string case checking, URL ...

Read More
Showing 1221–1230 of 8,010 articles
« Prev 1 121 122 123 124 125 801 Next »
Advertisements