Found 10483 Articles for Web Development

JavaScript Program for Equilibrium Index of an Array

Saurabh Anand
Updated on 07-Apr-2025 14:22:46

787 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 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 Diagonally Dominant Matrix

Ravi Ranjan
Updated on 06-Jun-2025 19:11:07

241 Views

Diagonally dominant matrix refers to square matrix having magnitude of diagonal element in a row greater than or equal to the sum of magnitude of non-diagonal elements in that row. In this article we are having a square matrix, our task is to write JavaScript program for diagonally dominant matrix. Users must be familiar with 2D matrix, nested for loop and conditional statement. Formula: $$\mathrm{|\:a_{ii}\:|\:\geq\:\displaystyle\sum\limits_{j ≠ i}\:|\:a_{ij}|}$$ for all i Where aij denotes the entry in the ith row and jth column Example Input: [A] = ... Read More

Image Classification using JavaScript

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

1K+ 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

3K+ 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

526 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

479 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

How to use protractor to check if an element is visible?

Shubham Vora
Updated on 06-Apr-2023 15:52:53

1K+ Views

We will learn to use Protractor to check if an element is visible. Protractor is an end-to-end testing framework for Angular and AngularJS applications. It uses Selenium WebDriver to automate browser interactions and provides a high-level API to write tests in JavaScript or TypeScript. It uses Jasmine as the test framework. It provides many features, such as automatic synchronization with the AngularJS application, page object model support, and more. Note − To use a protractor, make sure that installation and setup of the protractor have already been done. User may need to set the Execution Policy to ‘RemoteSigned’ Or ‘Unrestricted’ ... Read More

How to test the name of tag of an element using Protractor?

Shubham Vora
Updated on 06-Apr-2023 15:49:08

362 Views

We will learn to use protractor to test the name of the tag of an element. Protractor is an end-to-end testing framework for Angular and AngularJS applications. Protractor is built on top of WebDriverJS, which is a JavaScript implementation of the WebDriver API, and supports multiple browsers such as Chrome, Firefox, and Safari. It is popular among developers and testers because it provides a simple and effective way to test Angular applications without having to write complex code. Learning how to test the name of the tag of an element using a Protractor is a crucial aspect of automated testing ... Read More

How to test the id of an element using Protractor?

Shubham Vora
Updated on 06-Apr-2023 15:48:09

262 Views

We will learn to use a protractor to test the ID of an element. Protractor is an end-to-end testing framework for Angular and AngularJS applications. Protractor is built on top of WebDriverJS, which is a JavaScript implementation of the WebDriver API and supports multiple browsers such as Chrome, Firefox, and Safari. It is popular among developers and testers because it provides a simple and effective way to test Angular applications without writing complex code. Learning how to test the id of an element using Protractor is important for web developers and quality assurance (QA) testers who want to ensure that ... Read More

How to test if an element has class using Protractor?

Shubham Vora
Updated on 06-Apr-2023 15:46:33

601 Views

We will learn to use the protractor test if an element has class using Protractor. Protractor is an end-to-end testing framework for Angular and AngularJS applications. Protractor is built on top of WebDriverJS, a JavaScript implementation of the WebDriver API, and supports multiple browsers such as Chrome, Firefox, and Safari. Testing if an element has a specific class is important because it allows us to check if a certain style or behaviour is applied to the element as intended. This is especially useful in scenarios where the presence or absence of a specific class triggers certain styles or behaviours. By ... Read More

Advertisements