Articles on Trending Technologies

Technical articles with clear explanations and examples

Partial sum in array of arrays JavaScript

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

In the given problem statement our task is to get the partial sum in an array of arrays with the help of JavaScript functionalities. The partial sum at position (i, j) represents the sum of all elements from the top-left corner (0, 0) to the current position (i, j). Understanding the Problem An array of arrays (2D array) is a data structure where each element is itself an array. For example: [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] The partial ...

Read More

Reversing the order of words of a string in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 520 Views

We are required to write a JavaScript function that takes in a string as the only argument. The function should reverse the order of the words in the string and return the new string. The only condition is that we cannot use the inbuilt array method reverse(). For example − If the input string is − const str = 'this is a string'; Then the output string should be − string a is this Using Manual Array Reversal We can split the string into words, manually reverse ...

Read More

Killing Enemy in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 347 Views

In JavaScript, we can solve the "killing enemy" problem by finding the optimal position to place a bomb that kills the maximum number of enemies in a 2D grid. The bomb destroys all enemies in the same row and column until it hits a wall. Problem Statement Given a 2D grid where each cell is either a wall 'W', an enemy 'E', or empty '0', we need to find the maximum enemies we can kill using only one bomb. The bomb can only be placed in empty cells and kills all enemies in the same row and column ...

Read More

Finding the largest 5 digit number within the input number using JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 510 Views

We need to write a JavaScript function that takes in a string number of at least five digits and returns the greatest sequence of five consecutive digits found within the input number. Problem Statement Given a number string, find all possible 5-digit consecutive sequences and return the largest one as a number. Example Let's implement the solution step by step: const num = '123546544'; const findGreatestFiveDigit = (num = '') => { const str = num.toString(); const arr = []; ...

Read More

How to set the vertical scale factor of an Ellipse using FabricJS?

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

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

Read More

How to flip a Triangle vertically using FabricJS?

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

In this tutorial, we are going to learn how we can flip a Triangle object vertically using FabricJS. Triangle is one of the various shapes provided by FabricJS. In order to create a triangle, we will have to create an instance of fabric.Triangle class and add it to the canvas. We can flip a triangle object vertically using the flipY property. Syntax new fabric.Triangle({ flipY: Boolean }: Object) Parameters Options (optional) − This parameter is an Object which provides additional customizations to our ...

Read More

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

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

In this tutorial, we are going to learn how to set the vertical scale factor of a 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. Just as we can specify the position, colour, opacity and dimension of a textbox object in the canvas, we can also set the vertical scale factor of a textbox object. This can be done by using the scaleY property. Syntax new fabric.Textbox(text: ...

Read More

How to get the complete style declaration of character in IText using FabricJS?

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

In this tutorial, we are going to learn about how to get the complete style declaration of character 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 ...

Read More

How do I shift from jQuery to core JavaScript?

Manisha Patil
Manisha Patil
Updated on 15-Mar-2026 272 Views

JavaScript is a versatile programming language used to create interactive and dynamic web applications. While jQuery was once essential for simplifying JavaScript development, modern JavaScript (ES6+) now provides native methods that make jQuery less necessary. jQuery is a lightweight JavaScript library that simplifies DOM manipulation, event handling, and AJAX operations. It became popular because it solved cross-browser compatibility issues and provided a simpler syntax for common tasks. Why Developers are Moving from jQuery to Vanilla JavaScript Modern JavaScript Features: ES6+ provides powerful built-in methods that eliminate the need for jQuery's utility functions. ...

Read More

How to count text lines inside of a DOM element?

Saurabh Anand
Saurabh Anand
Updated on 15-Mar-2026 3K+ Views

Introduction The DOM (Document Object Model) is an API for HTML and XML documents that provides programmers control over a webpage's structure, appearance, and content. Counting text lines within DOM elements is useful for layout calculations, pagination, and content management. This article explores three methods to count text lines in DOM elements using JavaScript. Method 1: Using the scrollHeight Property The scrollHeight property returns the total height of an element, including content hidden by overflow. We can calculate the number of lines by dividing scrollHeight by the height of a single line of text. ...

Read More
Showing 15181–15190 of 61,297 articles
Advertisements