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
Removing smallest subarray to make array sum divisible in JavaScript
We are required to write a JavaScript function that takes in an array of positive integers as the first argument and a positive integer as the second argument. The function should figure out and return the length of the smallest subarray that we should delete from the original array in order to make its sum divisible by the number specified by the second argument. For example, if we have an array [3, 8, 2, 6] and want the sum divisible by 9, we need to remove the subarray [8, 2] of length 2. Problem Analysis The ...
Read MoreHow to create a Circle with not-allowed cursor on hover over objects using FabricJS?
In this tutorial, we are going to create a Circle with a not-allowed cursor on hover over objects using FabricJS. not-allowed 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. which are reusing the native cursor underhood. The hoverCursor property sets the style of the cursor when hovered over a canvas object. Syntax new fabric.Circle({ hoverCursor: String }: Object) Parameters options (optional) − This parameter is an Object which ...
Read MoreHow to Create a Currency Converter in JavaScript?
In this tutorial, we will be discussing how to create a currency converter in JavaScript. We will be discussing the various steps involved in creating such a converter. What is a Currency Converter? A currency converter is a tool that helps you convert one currency to another. For example, if you are from the United States and you are traveling to Europe, you will need to use a currency converter to convert your US dollars into Euros. Why Use JavaScript to Create a Currency Converter? JavaScript is a versatile programming language that can be used to ...
Read MoreHow to change string to be displayed as a superscript using JavaScript?
In this tutorial, we will learn how to display strings as superscript using JavaScript and HTML. Superscript text appears raised above the normal text baseline, making it smaller and positioned at half-height. This is commonly used in mathematical formulas like A2, B3, or scientific notations like 105. Superscript is essential for writing mathematical expressions, chemical formulas (like H2O+), and footnote references in web content. Using HTML Tag The simplest way to create superscript text is using the HTML tag. Any text inside this tag will automatically display as superscript. Syntax 102 = ...
Read MoreHow to add line height to multiline text in IText using FabricJS?
In this tutorial, we are going to learn about how to add line height to multiline text in IText object 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 ...
Read MoreHow to disable multiple specific control points of Image object using FabricJS?
In this tutorial, we are going to learn how to disable multiple specific control points of an Image object 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 disable multiple specific control points of an Image object, we use the setControlsVisibility method. Syntax setControlsVisibility(options: Object): fabric.Object Parameters options − This parameter accepts ...
Read MoreAccess an Element in Type Script
In TypeScript, to access HTML elements, we use the Document Object Model (DOM). The DOM defines an HTML and XML programming interface that visualizes a document's structure as a tree of nodes. Each node in the tree represents document elements like paragraphs, buttons, divs, headings, etc. The document object in TypeScript serves as the doorway to the DOM, allowing us to easily access and manipulate HTML elements. There are several ways to access elements: Using the document.getElementById() method Using the document.querySelector() method Using the document.getElementsByClassName() method ...
Read MoreDelete elements in first string which are not in second string in JavaScript
The problem statement asks us to delete elements from the first string that are not present in the second string. In other words, we need to keep only the characters from the first string that also exist in the second string, while preserving their original order. This problem can be viewed as finding the intersection of characters between two strings and returning a filtered version of the first string containing only common characters. What is a Map in JavaScript? We'll use a Map data structure to efficiently solve this problem. A Map is a collection of key-value ...
Read MoreSpiraling the elements of a square matrix JavaScript
In this problem statement, our main aim is to spiral the elements of a square matrix with the help of JavaScript functionalities. We'll traverse the matrix in a clockwise direction, starting from the top-left corner and moving in a spiral pattern. Understanding the Problem The problem is to write a function in JavaScript that converts a 2D matrix into a 1D array by traversing elements in a clockwise spiral pattern. For example, if we have a matrix: [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] ...
Read MoreFinding sum of multiples in JavaScript
In JavaScript, finding the sum of multiples of a given number within a specific range is a common programming problem. We need to identify all numbers divisible by the input number and calculate their sum using loops and conditional checks. Understanding the Problem The task is to find the sum of all multiples of a given number within a specified range. A multiple is any number that can be divided evenly by the given number (remainder is zero). For example: if we have number 3 and range 1 to 12, the multiples of 3 are: 3, 6, ...
Read More