Found 8895 Articles for Front End Technology

How to add and remove CSS classes to an element using jQuery?

Aayush Mohan Sinha
Updated on 10-Apr-2023 14:42:24

1K+ Views

CSS classes perform a pivotal function in designing web pages and have a significant influence on their comprehensive facade. Since more significance is being placed on the aesthetics of pages, customizing web pages dynamically can greatly boost their value. At first observation, this task might appear to be intimidating, but utilizing jQuery, it becomes effortless to append or extract CSS classes from an HTML component in real-time, thereby providing an expeditious and effortless method of producing interactive and dynamic web pages. By affixing or eliminating CSS classes, we can reform the presentation of components on the spot, predicated on user ... Read More

JavaScript Program for Find the smallest missing number

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

273 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

779 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

326 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

762 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

How TypeScript Compilation Works?

Shubham Vora
Updated on 06-Apr-2023 16:06:41

2K+ Views

The popular programming language TypeScript has been widely adopted by developers in recent years. It is a superset of JavaScript that enhances the language with static typing and other features to make complicated application development simpler and error-prone. However, TypeScript code must be compiled into JavaScript because it cannot be performed directly in a browser or server. Any developer using TypeScript must comprehend how TypeScript compilation operates. There are multiple processes in the TypeScript compilation process, including parsing, type-checking, outputting JavaScript, bundling, and execution. The TypeScript compiler parses the code during the parsing phase and creates an abstract syntax tree ... Read More

How to use protractor to wait for the element’s attribute to change to a particular value?

Shubham Vora
Updated on 06-Apr-2023 16:05:31

393 Views

We will learn to use protractor to wait for the element’s attribute to change to a particular value. Protractor is an end-to-end testing framework for Angular and AngularJS applications. Protractor has built-in support for waiting for Angular-specific elements to load and be ready before performing test operations. We need to learn this topic to ensure that tests only proceed when specific elements are ready, avoiding errors and improving the accuracy of the test results. Waiting for an attribute to change to a particular value also helps identify and debug issues related to data manipulation and other dynamic events on the ... Read More

How to use protractor to check whether text is present in an element or not?

Shubham Vora
Updated on 06-Apr-2023 15:59:51

362 Views

We will learn to use Protractor to check whether text is present in an element or not. Protractor is an end-to-end testing framework for Angular and AngularJS applications. It uses WebDriverJS and runs tests written in Jasmine or Mocha, allowing for automated browser testing of web applications. Protractor can simulate user interaction with the application, test for expected behaviour, and report on test results. It also includes several features designed specifically for Angular, such as the ability to wait for Angular-specific elements to load before executing tests. Note − To use a protractor, ensure that the protractor installation and setup ... Read More

Advertisements