Articles on Trending Technologies

Technical articles with clear explanations and examples

How to create a canvas with Text using FabricJS?

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

In this tutorial, we are going to learn about how to create a canvas with a Text object using FabricJS. We can display text on canvas by adding an instance of fabric.Text. Not only does it allow us to move, scale and change the dimensions of the text but it also provides additional functionality like text alignment, text decoration, line height which can be obtained by the properties textAlign, underline and lineHeight respectively. One difference between Text and Textbox is, Textbox is editable interactively while Text isn't. Syntax new fabric.Text(text: String, options: Object) Parameters ...

Read More

What are top JavaScript animation libraries?

Kalyan Mishra
Kalyan Mishra
Updated on 15-Mar-2026 1K+ Views

JavaScript animation libraries offer powerful alternatives to CSS animations, providing greater flexibility and advanced features that CSS alone cannot achieve. These libraries enable developers to create complex animations, 3D graphics, particle effects, and interactive experiences with better performance and cross-browser compatibility. This article explores the top JavaScript animation libraries that can transform your web projects with stunning visual effects. Anime.js Anime.js is a lightweight animation library designed to animate HTML elements, JavaScript objects, CSS selectors, DOM attributes, and arrays. It provides complete control over targeted elements with an intuitive API. Key Features: SVG animations and ...

Read More

How to create an Object representation of a Line object using FabricJS?

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

In this tutorial, we are going to learn about how to create an Object representation of a Line object 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 create an Object representation of a Line object, we use the toObject method. ...

Read More

How to add a parameter to the URL in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 28K+ Views

In JavaScript, you can add parameters to URLs using the URLSearchParams API. There are two primary methods: append() for adding new key-value pairs and set() for adding or updating parameters. The append() method adds new key-value pairs to the URL without removing existing ones. If the same key already exists, it creates multiple entries. The set() method adds a parameter if it doesn't exist, or replaces the value if the key already exists. Unlike append(), it ensures only one value per key. Using append() Method The append() method adds new parameters while preserving existing ones: ...

Read More

Replace whitespace in different elements with the same class in JavaScript?

Yaswanth Varma
Yaswanth Varma
Updated on 15-Mar-2026 517 Views

In this article we are going to learn about replacing whitespace in different elements with the same class in JavaScript. We'll explore multiple methods to remove spaces from text content across multiple HTML elements that share a common CSS class. Using split() and join() Methods The split() method divides a string into substrings and returns them as an array. When a separator is specified, the string is split at each occurrence of that separator. The join() method combines array elements back into a single string using a specified separator. Syntax string.split(" ").join("") Example ...

Read More

Pulling data from array into new independent variables JavaScript?

Yaswanth Varma
Yaswanth Varma
Updated on 15-Mar-2026 671 Views

In JavaScript, you can extract data from arrays and assign values to new independent variables using various techniques. This process is commonly called "destructuring" and allows you to unpack array elements into separate variables efficiently. An independent variable is a standalone variable that isn't influenced by other variables. When pulling data from arrays, these new variables become independent copies of the original array elements. Using Array Destructuring (Recommended) Array destructuring is the modern and most efficient way to extract array elements into independent variables: ...

Read More

Finding the smallest value in a JSON object in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 919 Views

Finding the smallest value in a JSON object is a common task in JavaScript. This involves traversing through an object's properties and comparing their numeric values to determine the minimum. When working with objects that contain numeric values, we need to iterate through all properties and find the one with the smallest value. JavaScript provides several approaches to accomplish this efficiently. Example Here's how to find the smallest value using the reduce() method: const obj = { "a": 4, "b": 2, "c": 5, ...

Read More

Calculating the average for each subarray separately and then return the sum of all the averages in JavaScript

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

In JavaScript, when working with arrays of subarrays, we often need to calculate the average for each subarray separately and then return the sum of all these averages. This can be efficiently accomplished using JavaScript's built-in array methods like reduce(). What is the reduce() Method in JavaScript? The reduce() method in JavaScript reduces an array to a single value by iterating over each element and applying a callback function that accumulates a value based on each iteration. It takes two main arguments: an accumulator (the accumulated value from previous iterations) and the current value being processed. ...

Read More

Sum of all multiples in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 350 Views

We need to write a JavaScript function that takes a number n as the first argument, followed by any number of divisor arguments. The function should sum all numbers up to n that are divisible by any of the specified divisors. Problem Statement Given a number n and multiple divisors, find the sum of all numbers from 1 to n that are multiples of any of the divisors. For example, if we call: sumMultiples(15, 2, 3) We need to find numbers up to 15 that are divisible by either 2 or 3: ...

Read More

Finding minimum steps to make array elements equal in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 369 Views

We are required to write a JavaScript function that takes in a number, num as the only argument. The function should first construct an array of n elements based on the following rule: arr[i] = (2 * i) + 1; Therefore, if the input number is 5, then the array should be: const arr = [1, 3, 5, 7, 9]; Our function is supposed to calculate and return the minimum number of steps it should take so that all the elements of the array become equal. Understanding the Problem Let ...

Read More
Showing 15621–15630 of 61,297 articles
Advertisements