Articles on Trending Technologies

Technical articles with clear explanations and examples

Queue Reconstruction by Height in JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 15-Mar-2026 337 Views

The Queue Reconstruction by Height problem involves arranging people in a queue based on their height and the number of taller people in front of them. Each person is represented as [h, k] where h is height and k is the count of people in front with height ≥ h. Understanding the Problem Given an array of people where each person is represented by [height, k], we need to reconstruct the queue. The key insight is that taller people don't affect the positioning of shorter people, so we can process people from tallest to shortest. For example, ...

Read More

Check if string ends with desired character in JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 15-Mar-2026 332 Views

In JavaScript, you can check if a string ends with a specific character using several built-in methods. The most common approaches are using endsWith(), charAt(), or bracket notation. Understanding the Problem We need to determine if a given string ends with a specific character. For example, checking if "Hello World!" ends with "!" should return true, while checking if "Hello World." ends with "!" should return false. Using endsWith() Method (Recommended) The endsWith() method is the most straightforward approach: const str1 = "Hello, Tutorials Point!"; const str2 = "Hello, World."; const desiredChar = "!"; ...

Read More

Validating a password using JavaScript

Aayush Mohan Sinha
Aayush Mohan Sinha
Updated on 15-Mar-2026 4K+ Views

Password validation is a critical security feature in web applications. JavaScript provides powerful tools to implement client-side password validation that checks for complexity requirements like length, character types, and special symbols. This helps ensure users create strong passwords that protect their accounts from unauthorized access. Problem Statement We need to create a JavaScript function that validates passwords based on these criteria: Password length must be between 6 and 20 characters Must contain at least one digit (0-9) Must contain at least one lowercase letter (a-z) Must contain at ...

Read More

Maximum subarray sum in circular array using JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 334 Views

We need to write a JavaScript function that finds the maximum possible sum of a subarray in a circular array. In a circular array, the last element connects to the first element, creating additional subarray possibilities. Problem Statement Given an array of integers, find the maximum sum of any non-empty subarray. The array is considered circular, meaning we can wrap around from the end to the beginning. Example: Input: [2, -2, 3, -1] Output: 4 Explanation: Maximum subarray is [3, -1, 2] (wrapping around) Algorithm Approach The solution uses two key insights: ...

Read More

How to create a canvas with progress cursor using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 347 Views

In this article, we are going to create a canvas with a progress cursor using FabricJS. A progress cursor indicates that a program is busy in the background but allows the user to interact with the interface. progress is one of the native cursor style available which can be used in the FabricJS canvas too. FabricJS provides various types of cursors like default, all-scroll, crosshair, col-resize, row-resize, etc., which are reusing the native cursor under the hood. Each of these cursors look slightly different based on operating system. Syntax new fabric.Canvas(element: HTMLElement|String, { defaultCursor: String }: ...

Read More

How to set the horizontal and vertical radius of an Ellipse using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 294 Views

In this tutorial, we are going to learn how to set the horizontal and vertical radius of an Ellipse using FabricJS. Ellipse is one of the various shapes provided by FabricJS. In order to create an ellipse, we will have to create an instance of fabric.Ellipse class and add it to the canvas. We can customize an ellipse object by specifying its position, color, opacity and dimension. However, the most important properties are rx and ry which allow us to assign the horizontal and vertical radius of Ellipse. Syntax new fabric.Ellipse({ rx : Number, ry: Number }: ...

Read More

How to create a Triangle with crosshair cursor on moving objects using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 399 Views

In this tutorial, we are going to create a Triangle with a crosshair cursor on moving objects using FabricJS. The crosshair is one of the native cursor styles available which can be used in the FabricJS canvas too. FabricJS provides various types of cursors like default, all-scroll, crosshair, col-resize, row-resize etc that reuse the native cursor under the hood. The moveCursor property sets the style of the cursor when the object is moved around in the canvas. This property is useful for providing visual feedback to users about the current ...

Read More

How to set the border scale factor of Textbox using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 440 Views

In this article, we are going to set the border scale factor of Textbox using FabricJS. We can customize, stretch or move around the text written in a textbox. In order to create a textbox, we will have to create an instance of fabric.Textbox class and add it to the canvas. We can use the borderScaleFactor property which specifies the scale factor of the object's controlling borders. Syntax new fabric.Textbox(text: String, { borderScaleFactor: Number }: Object) Parameters text − This parameter accepts a String which is the text string ...

Read More

How to change the selection color of text in IText using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 937 Views

In this tutorial, we are going to learn about how to change the selection color of text in IText using FabricJS. The IText class was introduced in FabricJS version 1.4, extends fabric.Text and is used to create IText instances. An IText instance gives us the freedom to select, cut, paste or add new text without additional configurations. There are also various supported key combinations and mouse/touch combinations which make text interactive which are not provided in Text. Textbox, however, which is based on IText allows us to resize the text rectangle and wraps lines automatically. This is not true ...

Read More

How to get the object scale factor of Image using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 302 Views

In this tutorial, we are going to learn how to get the object scale factor of Image using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to get the object scale factor of Image, we use the getObjectScaling method. Syntax getObjectScaling(): Object Parameters The getObjectScaling method does not take any parameters. Return Value This method returns an object containing the scale factors: ...

Read More
Showing 15001–15010 of 61,299 articles
Advertisements