Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
How to flip an Ellipse horizontally using FabricJS?
In this tutorial, we are going to learn how we can flip an Ellipse object horizontally 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 flip an ellipse object horizontally using the flipX property. Syntax new fabric.Ellipse({ flipX: Boolean }: Object) Parameters options (optional) − This parameter is an Object which provides additional customizations to our ...
Read MoreHow to disable the centered scaling of Textbox using FabricJS?
In this tutorial, we are going to learn how to disable the centered scaling 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. When being scaled via controls, assigning a true value to the centeredScaling property, uses the center as the object's origin of transformation. Syntax new fabric.Textbox(text: String, { centeredScaling: Boolean }: Object) Parameters ...
Read MoreConverting string to an array in JavaScript
In JavaScript, converting strings to arrays is a common task when you need to split text into characters or words for processing. JavaScript provides several built-in methods to accomplish this conversion efficiently. This article explores four different methods to convert strings to arrays, each suitable for different use cases and requirements. Using the split() Method The split() method is the most versatile approach for string-to-array conversion. It splits a string into an array of substrings based on a specified separator and returns a new array without modifying the original string. The split() method accepts two optional ...
Read MoreGroup by JavaScript Array Object
Suppose we have an array of arrays that contains the marks of some students in some subjects like this − const arr = [ ["English", 52], ["Hindi", 154], ["Hindi", 241], ["Spanish", 10], ["French", 65], ["German", 98], ["Russian", 10] ]; We are required to write a JavaScript function that takes in one such array and returns an object of objects. The return object should contain an object for each unique subject, and that object should contain information like the number of appearances ...
Read MoreSorting array of Number by increasing frequency JavaScript
We are required to write a JavaScript function that takes in an array of numbers that might contain some repeating numbers. The function should sort the array such that the elements that are repeated for the least number of times appears first followed by the elements with increasing frequency. For example − If the input array is − const arr = [1, 1, 2, 2, 2, 3]; Then the sorted array should be − const output = [3, 1, 1, 2, 2, 2]; How It Works The solution ...
Read MoreArmstrong number within a range in JavaScript
Armstrong Numbers: A positive integer is called an Armstrong number (of order n) if − abcd... = a^n + b^n + c^n + d^n + ... where n is the number of digits. For example, 153 is an Armstrong number because 1³ + 5³ + 3³ = 1 + 125 + 27 = 153. We are required to write a JavaScript function that takes in an array of exactly two numbers specifying a range. The function should return an array of all the Armstrong numbers that falls in that range (including the start and end ...
Read MoreFinding points nearest to origin in JavaScript
Problem We need to write a JavaScript function that takes an array of coordinates and a number as arguments. The function should find and return the specified number of closest points to the origin (0, 0) using Euclidean distance. The Euclidean distance between a point (x, y) and the origin is calculated as: √(x² + y²) Example Input and Output For the input: const arr = [[3, 3], [5, -1], [-2, 4]]; const num = 2; The expected output should be: [[3, 3], [-2, 4]] Solution Using Sort ...
Read MoreRemoving all spaces from a string using JavaScript
JavaScript provides several efficient methods to remove all spaces from a string. This is a common requirement in web development for tasks like data validation, formatting user input, or preparing strings for processing. Problem Statement Given a string containing spaces, we need to remove all space characters to create a continuous string without any gaps. Sample Input: "Hello world! This is a test string." Sample Output: "Helloworld!Thisisateststring." Methods to Remove Spaces We'll explore four different approaches to solve this problem: Using Regular Expression with ...
Read MoreFinding length of repeating decimal part in JavaScript
When dividing 1 by certain numbers, the decimal result may have a repeating pattern. This function finds the length of that repeating decimal part, but only for numbers that are coprime with 10 (share no common factors except 1). Problem Statement We need to write a JavaScript function that: Checks if a number is coprime with 10 (shares no common factors except 1) If not coprime, returns -1 If coprime, returns the length of the repeating decimal part when 1 is divided by that number ...
Read MoreHow to flip an Ellipse vertically using FabricJS?
In this tutorial, we are going to learn how we can flip an Ellipse object vertically 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 flip an ellipse object vertically using the flipY property. Syntax new fabric.Ellipse({ flipY: Boolean }: Object) Parameters options (optional) − This parameter is an Object which provides additional customizations to our ...
Read More