Found 6710 Articles for Javascript

How to create a slider to map a range of values in JavaScript ?

Rohan Singh
Updated on 17-Jul-2023 19:13:44

982 Views

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 for our slider. ... Read More

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

Rushi Javiya
Updated on 14-Jul-2023 10:12:49

618 Views

JavaScript is a single-threaded programming language. It means it executes all code of the application in a step-by-step manner. In some situations, we need to execute computationally extensive tasks. For example, applications with large databases need to process large amounts of data, which may take more time than usual. To improve the application performance in this case, we need to use multi-threading, which can run multiple tasks concurrently. JavaScript doesn’t support multi-threading, but web workers allow us to run particular tasks in the background, improving the application's performance and user experience. However, there are some limitations in using the web ... Read More

Implode an array with jQuery/JavaScript

Rushi Javiya
Updated on 14-Jul-2023 10:06:40

927 Views

In this tutorial, we will learn to implode a given array using JavaScript and JQuery. In web development, many situations occur where we must implode the array. For example, we have given a list of tags and need to implode them into a single string to insert into the web page. Another case where we may require to implode an array is while writing the SQL queries. Here, we will learn 4 approaches to join the elements of the given array. Using the Array.join() Method to Implode the Array The array.join() method allows us to join the array elements into ... Read More

How to create bar chart in react using material UI and Devexpress?

Rushi Javiya
Updated on 14-Jul-2023 10:00:16

1K+ Views

The material UI is a popular CSS library that we can use to style the React application. It contains various pre-styled React components that we can use directly in the application by importing them into the code. The 'dx-react-chart-material-ui’ is an NPM package of Devexpress that can connect the material-ui and ‘dx-react-chart’ library of dev express. The ‘dx-react-chart’ is used to create a chart, and material UI is used to style the chart. Users can execute the below command to install the material UI in the React application. npm install @mui/material @emotion/react @emotion/styled Also, execute the below command to ... Read More

How to create and download CSV file in JavaScript?

Rushi Javiya
Updated on 14-Jul-2023 09:59:03

5K+ Views

JavaScript has great capability to manipulate various data and handle them with files of different formats. Sometimes, developers require to handle the data with the CSV file while developing web applications using JavaScript. For example, we are building an e-commerce platform where users can buy and sell products. Also, we want to allow users to download their order details according to the time horizon into the CSV file. We need to interact with the data and CSV files in such cases. Another example is online banking sites allow us to download the transaction details in CSV files. In this ... Read More

How to Create an Image Element Dynamically using JavaScript?

Rushi Javiya
Updated on 18-Nov-2024 16:42:01

12K+ Views

To create an image element dynamically using JavaScript, we can use various approach based on our use case. We will be understanding two such approach in this article with examples and stepwise explaination of examples. In this article our task is to create an image element dynamically using JavaScript. Approaches to Create an Image Element Here is a list of approaches to create an image element dynamically using JavaScript which we will be discussing in this article with stepwise explaination and complete example codes. Using createElement() Method Using Image() Constructor ... Read More

Difference Between textContent and innerHTML

Pradeep Kumar
Updated on 13-Jul-2023 11:00:14

512 Views

There are various methods used in web development to change the text or add additional elements to an HTML element's content. TextContent and innerHTML are two frequently used properties for changing an HTML element's content. Although these two qualities might appear to be identical, they have distinct behaviours and applications. The text content of an element and all of its descendants can be set or retrieved using the textContent attribute. Without any HTML tags, it merely provides the text information. In contrast, the innerHTML property sets or retrieves an element's HTML content, including all HTML tags and their associated ... Read More

Difference Between String Slice and Substring Methods

Pradeep Kumar
Updated on 13-Jul-2023 10:35:22

2K+ Views

JavaScript is a dynamic and most popular programming language which can be used on both client side and server side. JavaScript is used to create interactive web pages. It has many frameworks such as React JS, Angular JS, Node JS etc., JavaScript contains many inbuilt functions to perform various tasks. There are functions that are used to manipulate the strings. Str.slice and str.substring are two of those inbuit functions that can manipulate strings. Although the functionalities of both the functions are almost similar, there are a few differences between them String.slice() Method This method returns a part of the string ... Read More

JavaScript Program to Find Longest Common Prefix Using Word by Word Matching

Prabhdeep Singh
Updated on 12-Jul-2023 10:08:00

346 Views

Prefixes are the substrings that start from the zeroth index of the given string and can be of any size from 1 to the complete length of the string. We are given a set of strings and we have to find the common prefix among all of them in the JavaScript programming language. We have to implement the word-by-word matching approach in which we will match the words instead of the complete strings. Input arr = ["zefkefgh", "zefkdefij", "zeffdzy", "zefkdabacd"]; Output zef Explanation From all the given strings, we have the first three characters, the same and the remaining ... Read More

JavaScript Program to Find Minimum Insertions to Form a Palindrome

Prabhdeep Singh
Updated on 12-Jul-2023 10:51:42

236 Views

We are given a string and we have to find the minimum number of different character that we need to insert in the given string at any place so that the final string will be palindrome. A palindrome is a string that is just equal to the reverse of it. This problem is of dynamic programming, so we will first go for the recursive approach, then we will memorize it, and at the end we will see the tabulation of the memorization approach. Recursive ApproachExample const max = 1e5; // defining the upper limit // function to ... Read More

Advertisements