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
Web Development Articles
Page 136 of 801
JavaScript program for Minimum Product Subset of an Array
JavaScript Program for Minimum product subset of an array is a common problem that arises in the field of computer science and programming. The problem statement requires us to find the minimum product that can be obtained from any subset of the given array. A minimum product subset of an array is a subset of array elements that yields the smallest possible product. Several algorithms are available for identifying this subset, including dynamic programming, greedy algorithms, and branch and bound. The selection of the algorithm is determined by the particular constraints and specifications of the problem at hand. ...
Read MoreJavaScript Program for Number of unique triplets whose XOR is zero
JavaScript Program for the Number of unique triplets whose XOR is zero is a common programming problem that requires finding the number of unique triplets in a given array whose XOR is equal to zero. The XOR operation is a bitwise operator that takes two bits and returns 1 if the bits are different, and 0 if they are the same. In this problem, we need to find all possible combinations of three numbers in the array, where the XOR of the triplet is zero. Problem Statement We are required to find the number of unique triplets in ...
Read MoreJavaScript Program for Pairs such that one is a power multiple of other
JavaScript Program for pairs such that one is a power multiple of the other is a problem that involves finding pairs of numbers where one number can be expressed as a power of another number. In this tutorial, we will explore how to write a JavaScript program to solve this problem using different approaches and algorithms. A power multiple relationship exists when one number is equal to another number raised to some integer power. For example, 8 is a power multiple of 2 because 2³ = 8. Problem Statement Given an array of integers, we need to ...
Read MoreJavaScript Program for Pairwise Swapping Elements of a Given Linked List
In this tutorial, we will learn how to implement a JavaScript program for pairwise swapping elements of a given linked list. This operation swaps adjacent elements in pairs, which can be useful for reorganizing data, rearranging elements, or optimizing algorithms. We will provide a step-by-step approach to implementing the algorithm, explaining the logic and code behind it. By the end of this tutorial, you will understand how to implement pairwise swapping in a linked list using JavaScript. Problem Statement Given a linked list, the task is to swap elements pairwise. Elements at consecutive positions are swapped with ...
Read MoreHow to switch between multiple CSS stylesheets using JavaScript?
In this tutorial, we will learn to switch between multiple CSS stylesheets using JavaScript. Have you ever thought that when you toggle the theme of TutorialsPoint's website, how it changes the CSS of the whole website? Here is a simple answer. When the user presses the button, it switches the CSS stylesheets for the website like it removes the stylesheet for the white theme and adds the stylesheet for the dark theme. Here, we will see examples of switching between multiple CSS files using JavaScript. Syntax Users can follow the syntax below to switch between multiple ...
Read MoreJavaScript Program for Writing A Function To Get Nth Node In A Linked List
Linked list is a linear data structure where nodes are connected by storing the address of the next node. Finding the nth node means retrieving the value at the nth position in the linked list, which can be accomplished using iterative or recursive methods. Problem Example Given linked list: 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> null Node to find: 3rd position Output: 3 Explanation: The value at the 3rd position is 3. Using Iterative Approach This approach traverses the linked list using a ...
Read MoreJavaScript Program To Add Two Numbers Represented By Linked Lists- Set 1
Adding two numbers is an easy task but could be tricky if the numbers are given in the form of the linked list. Each node of the linked list contains the digit of the number it represents in a continuous manner from the first node to the last node. We will be given two linked lists representing two different numbers and we have to add them and return the third number in the form of a linked list. Problem Statement Given two linked lists where each node contains a single digit, we need to add the numbers they ...
Read MoreHow to control fps with requestAnimationFrame?
The fps (frames per second) is crucial for animations and games, determining how many times the screen updates per second. JavaScript's requestAnimationFrame() typically runs at 60fps, but we can control this rate using different approaches. For example, a video is a continuous sequence of images shown at short intervals. Higher fps provides smoother animations, while lower fps can create choppy effects. Understanding fps control helps optimize performance and create desired visual effects. Using setTimeout() with requestAnimationFrame The setTimeout() function can delay requestAnimationFrame() calls to control fps. We calculate the interval as 1000/fps milliseconds. Syntax ...
Read MoreWhat is the App Shell Model in JavaScript?
The App Shell Model is a design pattern that separates a web app's UI shell from dynamic content. The shell includes the core HTML, CSS, and JavaScript needed for the interface, while content is loaded dynamically. This approach is fundamental to Progressive Web Apps (PWAs) for improved performance and user experience. What is the App Shell? The app shell consists of the minimal HTML, CSS, and JavaScript required to power the user interface. It includes: Navigation and header components Layout structure and styling Loading indicators and placeholders ...
Read MoreHow to make a word count in textarea using JavaScript?
Creating a word counter for textarea elements is a common requirement in web applications. This functionality helps users track their input length, especially useful for forms with character or word limits. We'll explore two different JavaScript approaches to implement this feature. Method 1: Counting Words by Analyzing Spaces and Newlines This approach manually iterates through each character in the textarea, counting spaces and newline characters to determine word boundaries. Implementation Steps Step 1 − Create an HTML file with a textarea element Step 2 − Add paragraph elements to ...
Read More