Found 6685 Articles for Javascript

How to create form dynamically with the JavaScript

Aman Gupta
Updated on 11-Apr-2023 13:59:00

5K+ Views

Overview To create a HTML form fully dynamic can be created using some of the Document Object Model (DOM) methods such as createElement(), setAttribute(), appendChild(). These DOM methods will help us to build a dynamic HTML form. Our approach to building this dynamic form will be by creating all the elements in the script tag , setting the attribute to add some functionality and at last when our element is ready to serve we will append it in the parent of the element. So all the elements appended inside the parent form tag are the children elements. Syntax The ... Read More

How to create a FAQ page using JavaScript

Aman Gupta
Updated on 11-Apr-2023 13:54:40

571 Views

Overview The Frequent Asked Question (FAQ) is the main feature for the website which deals with the selling of products, registration for training or companies in a particular domain. There are many problems which arise for many users or can arise, so these questions and the solution for these problems are displayed in the FAQ section, so that if any user is facing any error he can resolve it by going through the FAQ part of the website and can continue his work. Approach The main approach to make a FAQ is an accordion. All the frequently asked questions ... Read More

How to Create a Dropdown List with Array Values using JavaScript

Aman Gupta
Updated on 11-Apr-2023 13:49:54

7K+ Views

Overview To attain the options in the Dropdown list without disturbing the frontend of the web page can be with the help of array. As in the array we can store as many numbers of the option or values. So without directly putting those values in the HTML part of the code in the select tag we can render them from an array which makes it easy to add more value without disturbing the User Interface (UI) of the page. Approach This is a very simple technique, by using this technique we can easily render the options value to ... Read More

How to add bootstrap toggle-switch using JavaScript?

Aayush Mohan Sinha
Updated on 10-Apr-2023 14:45:38

1K+ Views

The Bootstrap library provides a number of features to the user to make their coding experience smooth. One of such features which the user can choose from is the toggle-switch. The toggle-switch, one of its useful features, provides users the ability to add components which can switch between two states such as on and off. Bootstrap Toggle-switch The Cascading Style Sheets (CSS) framework Bootstrap is a toolkit that makes it simpler and more standards-compliant to create websites. It can be used, alongside JavaScript, to create a responsive user interface. The simple Bootstrap toggle-switch component is used to select one of ... Read More

JavaScript Program for Find the smallest missing number

Saurabh Anand
Updated on 10-Apr-2023 13:56:51

272 Views

We are given a sorted array of distinct non-negative integers, here we have to find the smallest missing number. Hence in this tutorial, we will explore different methods to solve this problem and discuss their time complexities with various examples. Understanding the Problem The problem statement is quite simple. Given a sorted array of distinct non-negative integers, we need to find the smallest missing number in it. Let's take an example to understand the problem. Example Let’s say that we have an array [1, 2, 4, 5, 6]. Here, We can see that there is a space between the ... Read More

JavaScript program to find the lost element from a duplicated array

Saurabh Anand
Updated on 10-Apr-2023 13:55:14

777 Views

We have problem to write a program in JavaScript that can identify the missing element in a duplicated array. The input for the program will be an array that contains duplicate elements except for one, which is missing. The program should be able to identify the missing element and return it as output. Prerequisite to solve this problem requires an understanding of JavaScript arrays and how to manipulate them to find the missing element. We must develop a program that should be efficient and able to handle large arrays with many duplicate elements. Problem Statement We are given ... Read More

JavaScript Program for Find k pairs with smallest sums in two arrays

Saurabh Anand
Updated on 10-Apr-2023 13:52:36

191 Views

In this article, we will first find all the pairs that can be made with two arrays. Then, according to the value of k, we will display the pairs with the smallest sums in two arrays. Here, we will first use the brute-force method to solve the problem, then we will use various methods to optimize the same. So, let’s get started with the problem statement and some examples. Problem Statement We are given with the two arrays arr1[] and arr2[] sorted in ascending order, and a nonnegative integer k, the objective is to find k pairs with ... Read More

JavaScript Program for Equilibrium index of an array

Saurabh Anand
Updated on 10-Apr-2023 13:47:28

322 Views

The position where the sum of the elements to its left and right equals one another is known as the equilibrium index of an array. To put it another way, if we take a look at an array of size n, the equilibrium index i is a point such that − arr[0] + arr[1] + ... + arr[i-1] = arr[i+1] + arr[i+2] + ... + arr[n-1] where i is the equilibrium index and arr is the input array. We may alternatively state that the array is divided into two parts by the equilibrium index i such that the total ... Read More

JavaScript Program for Diagonally Dominant Matrix

Saurabh Anand
Updated on 10-Apr-2023 13:40:44

114 Views

Matrix or matrices are great tools in computer science and mathematics for quickly approximating difficult calculations. A matrix is a collection of numbers organized in rows and columns that can represent data or mathematical problems. By this article, we will learn about the Diagonally Dominant matrix. We will look at the concepts, algorithms, and examples of diagonally dominant matrices, as well as their implementations in a variety of programming languages. Diagonally Dominant Matrix We can call a square matrix diagonally dominant if, for every row in the matrix, the magnitude of the diagonal entry in a row is ... Read More

Image Classification using JavaScript

Shubham Vora
Updated on 07-Apr-2023 09:45:22

758 Views

The meaning of image classification is to extract as much information from the image as possible. For example, when you upload an image to Google photos, it extracts information from the image and suggests the location based on that. We can use OpenCV to detect every small information from the image and predict the image. Training and testing models from scratch using JavaScript requires lots of effort, and also, it requires the proper dataset containing the different images. So, in this tutorial, we will use the pre-trained model of ml5.js to classify the image. The ml5.js library contains various pre-trained ... Read More

Advertisements