Articles on Trending Technologies

Technical articles with clear explanations and examples

Determining isomorphic strings JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 875 Views

Two strings are isomorphic if characters in one string can be mapped to characters in another string while preserving the structure. Each character must map to exactly one character, and no two characters can map to the same character. Understanding Isomorphic Strings For strings to be isomorphic: They must have the same length Characters at the same positions must follow a consistent mapping pattern The mapping must be bijective (one-to-one) Example const str1 = 'egg'; const str2 = 'add'; // Check if strings are isomorphic const isIsomorphic = (str1 = '', str2 ...

Read More

Creating a Projectile class to calculate height horizontal distance and landing in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 266 Views

We need to create a JavaScript class called Projectile that simulates projectile motion physics. This class calculates horizontal distance traveled by a projectile given initial conditions. Problem Statement Create a Projectile class that takes three parameters during initialization: Starting height (h0): 0 ≤ h0 < 200 Starting velocity (v0): 0 < v0 < 200 Launch angle (a): 0° < a < 90°, measured in degrees The class should include a horiz method that calculates horizontal distance traveled at time t. Physics Formula The ...

Read More

Greatest sum of average of partitions in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 221 Views

We are required to write a JavaScript function that takes in an array of numbers, arr, as the first argument, and a number, num, (num ≤ size of arr), as the second argument. Our function should partition the array arr into at most num adjacent (non-empty) groups in such a way that we leave no element behind. From all such partitions, our function should pick that partition where the sum of averages of all the groups is the greatest. Problem Statement Given an array and a maximum number of partitions, find the partition that maximizes the sum ...

Read More

How to add dashed stroke to a Circle using FabricJS?

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

In this tutorial, we are going to learn how to add a dashed stroke to a Circle using FabricJS. Circle is one of the various shapes provided by FabricJS. In order to create a circle, we will have to create an instance of fabric.Circle class and add it to the canvas. The strokeDashArray property allows us to specify a dash pattern for the object's stroke. Syntax new fabric.Circle({ strokeDashArray: Array }) Parameters options (optional) − This parameter is an Object which provides additional customizations to our circle. Using this parameter, properties such as colour, ...

Read More

How to set the horizontal scale factor of a Circle using FabricJS?

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

In this tutorial, we are going to learn how to set the horizontal scale factor of a Circle using FabricJS. Circle is one of the various shapes provided by FabricJS. In order to create a circle, we will have to create an instance of fabric.Circle class and add it to the canvas. Just as we can specify the position, colour, opacity and dimension of a circle object in the canvas, we can also set the horizontal scale of a circle object. This can be done by using the scaleX property. Syntax new fabric.Circle({ scaleX : Number }: ...

Read More

How to make the controlling corners of a Rectangle transparent using FabricJS?

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

In this tutorial, we are going to learn how to make the controlling corners of Rectangle transparent using FabricJS. Rectangle is one of the various shapes provided by FabricJS. In order to create a Rectangle, we will have to create an instance of fabric.Rect class and add it to the canvas. The transparentCorners property allows us to make the controlling corners of Rectangle transparent. Syntax new fabric.Rect({ transparentCorners: Boolean }: Object) Parameters Options (optional) − This parameter is an Object which provides additional ...

Read More

How to set the text overline of IText using FabricJS?

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

In this tutorial, we are going to learn how to set the text overline of 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 for IText as ...

Read More

FabricJS – How to check if a specified control is visible in Line?

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

In this article, we are going to learn about how to check if a specified control is visible in Line using FabricJS. A Line element is one of the basic elements provided in FabricJS. It is used for creating straight lines. Because line elements are geometrically one-dimensional and do not contain an interior, they are never filled. We can create a line object by creating an instance of fabric.Line, specifying the x and y coordinates of the line and adding it to the canvas. In order to check if a specified control is visible in Line object, we use the ...

Read More

How to set the position of Image from left using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 1K+ Views

In this tutorial, we are going to learn how to set the position of Image from left 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 set the position of Image from left, we use the left property. Syntax new fabric.Image( element: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | String, { left: Number }: Object, callback: function) Parameters ...

Read More

How to create a dropdown list using JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 14K+ Views

We will learn to create a dropdown list using HTML and JavaScript below. Before starting with the article, let's understand the dropdown list and why we need to use it. The dropdown list gives multiple choices to users and allows them to select one value from all options. However, we can do the same thing using multiple radio buttons, but what if we have hundreds of choices? Then we can use the dropdown menu. When users click the dropdown button, it opens all the choices, and users can select anyone. Also, the dropdown provides a better user experience ...

Read More
Showing 15351–15360 of 61,298 articles
Advertisements