Articles on Trending Technologies

Technical articles with clear explanations and examples

Implode an array with jQuery/JavaScript

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

In JavaScript and jQuery, "imploding" an array means joining its elements into a single string. This is commonly needed when displaying lists, generating SQL queries, or creating comma-separated values. We'll explore 4 different approaches to join array elements into strings. Using the Array.join() Method (Recommended) The join() method is the most efficient way to implode an array. It joins all elements into a string with a specified delimiter. Syntax array.join(delimiter) The delimiter parameter is optional. If omitted, elements are separated by commas. Example: Basic Join ...

Read More

Get the YouTube video ID from a URL using JavaScript

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

Every YouTube video has a unique URL through which we can access it in the browser. Every YouTube video contains a unique video id, which makes the URL unique. Sometimes, developers need to extract the video id from the YouTube URL. We need to play with the YouTube URL string to extract the video id from the URL, which we will do in this tutorial. We will learn different approaches to getting the video id from a full URL. Using the split() Method JavaScript contains the built-in split() method, which allows users to split the string into ...

Read More

JavaScript Program for Rotate Doubly linked list by N nodes

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

A doubly linked list is a linear data structure where each node stores references to both the next and previous nodes. In this tutorial, we'll learn how to rotate a doubly linked list by N nodes in both clockwise and counter-clockwise directions. Rotation means moving elements from one end of the list to the other. For N rotations, we take N nodes from one end and move them to the opposite end while maintaining the doubly linked structure. Understanding Rotation Direction Counter-clockwise rotation: Move the first N nodes to the end of the list. Clockwise rotation: Move ...

Read More

What are the restrictions of web workers on DOM in JavaScript?

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

JavaScript is a single-threaded programming language, executing all code step-by-step. For computationally intensive tasks like processing large datasets, this can cause performance bottlenecks and poor user experience. Web workers provide a solution by running tasks in background threads, but they have strict limitations when it comes to DOM access. Web workers operate in a separate thread context, isolated from the main thread for security and performance reasons. This isolation creates several important restrictions when working with DOM elements. Key DOM Restrictions of Web Workers 1. No Direct DOM Access Web workers cannot access DOM elements directly. ...

Read More

JavaScript Program for Equilibrium Index of an Array

Saurabh Anand
Saurabh Anand
Updated on 15-Mar-2026 898 Views

To write a JavaScript program for equilibrium index of an array, we are going to discuss three different approaches with detailed explanation and example codes. The equilibrium index of an array is the position where the sum of the elements to its left and right equals one another. In this article we are having an array of integers, our task is to write a JavaScript program for equilibrium index of an array. Example Input: arr = [-7, 1, 5, 2, -4, 3, 0] Output: Equilibrium index: 3 At index 3, left sum = -7 ...

Read More

JavaScript program for Minimum move to end operations to make all strings equal

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

There are many problems that require a certain level of expertise and creativity to solve. One such problem is determining the minimum number of moves required to make all strings equal. In this article, we will explore how to solve this problem using JavaScript programming. First, let's define the problem. Problem Statement Given an array of strings, we need to find the minimum number of moves required to make all strings equal. In a move, we can move the first character of a string to the end of the same string. Example Consider the following array ...

Read More

Handling Promise rejection with a catch while using await in JavaScript

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

In JavaScript, when working with async/await syntax, you need proper error handling for rejected promises. While Promise chains use .catch(), async/await functions require try-catch blocks to handle promise rejections. Basic Promise Creation Let's start with the fundamental syntax for creating promises: let testPromise = new Promise((resolve, reject) => { // perform some operation // resolve(value) for success // reject(error) for failure }); Example: Promise with .then() and .catch() Here's how traditional promise handling works with .then() and .catch() methods: ...

Read More

JavaScript Program to Find k Pairs with Smallest Sums in Two Arrays

Saurabh Anand
Saurabh Anand
Updated on 15-Mar-2026 430 Views

To find k pairs with smallest sums in two arrays in JavaScript, we will be using sorted arrays in ascending order. We are going to discuss two different approaches with stepwise explanation and examples. In this article we are having two arrays and a value of k, our task is to find k pairs with smallest sums in two arrays. Users must be familiar with JavaScript arrays, loops and conditional statement. Example Input: arr1 = [1, 7, 11], arr2 = [2, 4, 6] k = 3 Output: [[1, 2], [1, 4], [1, 6]] Input: ...

Read More

JavaScript program to find Number of Squares in an N*N grid

AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Mar-2026 3K+ Views

A grid is a 2-dimensional arrangement of squares divided into rows and columns. From a given N*N square grid we have to calculate the total number of squares possible. There are multiple ways to find the number of squares in a given grid. In this article, we are going to learn about various approaches for calculating the number of squares in a given grid of size N*N. Understanding the Problem In an N×N grid, we can form squares of different sizes. For example, in a 4×4 grid, we can have: 1×1 squares: 16 ...

Read More

JavaScript Program to Find the Lost Element from a Duplicated Array

Ravi Ranjan
Ravi Ranjan
Updated on 15-Mar-2026 1K+ Views

To find the lost element from a duplicated array in JavaScript, we will be discussing various approaches. Prerequisites to solve this problem include understanding of JavaScript arrays, loops, Set object, and binary search. In this article we have two arrays where one array is a duplicate of the other with one missing element. Our task is to find the lost element from the duplicated array in JavaScript. Problem Statement Given two arrays where the second array is missing exactly one element from the first array, we need to identify that missing element. Input: array1 = ...

Read More
Showing 14011–14020 of 61,297 articles
Advertisements