Articles on Trending Technologies

Technical articles with clear explanations and examples

How to create a canvas with Circle using FabricJS?

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

In this tutorial, we are going to learn about how to create a canvas with a Circle object 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. Syntax new fabric.Circle({ radius: Number }: Object) Parameters options (optional) − This parameter is an Object which provides additional customizations to our object. Using this parameter, properties such as colour, cursor, ...

Read More

How to Access element from Table using JavaScript?

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

To access table elements using JavaScript, you can use methods like document.getElementById() or document.getElementsByTagName() to select the table, then access individual rows and cells. This article demonstrates how to access table rows and create an interactive hover effect. Basic Table Access Methods JavaScript provides several ways to access table elements: By ID: document.getElementById('tableId') - Access a specific table By Tag Name: document.getElementsByTagName('tr') - Access all table rows Table Properties: Use table.rows or table.childNodes to access rows Example: Interactive Table with Hover Effect Let's create a table where rows highlight when you hover over ...

Read More

Converting two arrays into a JSON object in JavaScript

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 15-Mar-2026 5K+ Views

Given two arrays and the task is to convert those two arrays into a JSON object. Where the first array elements are keys of the object and the second array elements are values of the object. Input-Output Scenario Let's look into the scenario of how two arrays will be converted into a JSON object. Consider two arrays are having some elements. Now, we need to convert these two arrays into a JSON object. Array1 = [1, 2, 3, 4]; Array2 = ['A', 'B', 'C', 'D']; Output = {"1":"A", "2":"B", "3":"C", "4":"D"} //JSON object ...

Read More

Finding Common Item Between Arbitrary Number of Arrays in JavaScript

Sakshi Jain
Sakshi Jain
Updated on 15-Mar-2026 408 Views

Finding common elements among multiple arrays is a frequent requirement in JavaScript programming. This problem involves identifying elements that appear in every array within a collection of arrays. What are Arbitrary Number of Arrays An arbitrary number of arrays refers to any collection of multiple arrays (more than two) where we need to find intersection elements. These arrays can contain random elements and are typically organized as an array of arrays or nested data structure. // Example: Array of arrays const arrayCollection = [ [1, 2, 3, 4], [2, 3, 5, 6], ...

Read More

Function to find out palindrome strings JavaScript

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

In this problem statement, our aim is to create a function to find out that the given string is palindrome with the help of Javascript functionalities. So for solving this problem first we need to understand the problem in simple terms. Understanding the Problem Statement We have given a string as an input string and our main aim is to check if the string is a palindrome string or not. If it is palindrome then return true otherwise return false. What is a Palindrome? A palindrome is a string that reads the same forwards and backwards. ...

Read More

Calculating h index of a citation in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 486 Views

The h-index is a metric used to measure both the productivity and citation impact of a researcher. In JavaScript, we can calculate it by analyzing an array of citation counts for a researcher's papers. What is H-Index? A researcher has h-index of value h if they have h papers with at least h citations each, and the remaining papers have no more than h citations each. For example, if a researcher has papers with citations [1, 6, 3, 0, 5], they have 3 papers with at least 3 citations (papers with 6, 3, and 5 citations), so the ...

Read More

Is the reversed number a prime number in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 356 Views

We are required to write a JavaScript function that takes in a number and returns true if the reverse of that number is a prime number, false otherwise. Problem Understanding To solve this problem, we need two helper functions: A function to reverse the digits of a number A function to check if a number is prime Solution Implementation Here's the complete solution with helper functions: const num = 13; const findReverse = (num) => { return +num .toString() .split('') .reverse() .join(''); }; const isPrime = (num) => { if (num

Read More

How to create a Circle with a background colour using FabricJS?

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

In this tutorial, we are going to create a Circle with background colour using FabricJS. Circle is one of the various shapes provided by FabricJS. In order to create a circle, we have to create an instance of fabric.Circle class and add it to the canvas. The backgroundColor property allows us to assign a colour to our object's background. It is the colour of the container (where the circle lives) which is square in shape. Syntax new fabric.Circle({ backgroundColor: String }: Object) Parameters ...

Read More

Reversing the even length words of a string in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 415 Views

We are required to write a JavaScript function that takes in a string and reverses the words in the string that have an even number of characters in them. Let's say the following is our string: const str = 'This is an example string'; We want to reverse the even length words of the above string i.e. reverse the following words: This (4 characters) is (2 characters) an (2 characters) string (6 characters) The word "example" has 7 characters (odd length), so it remains unchanged. Syntax ...

Read More

Using one array to help filter the other in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 160 Views

When working with arrays of objects, you often need to filter one array based on values from another array. This is a common requirement when you have a list of items and want to keep only those that match specific criteria. Problem Statement Given an array of objects and an array of values, we need to filter the objects array to include only those objects whose property matches values in the second array. Sample Data Let's start with these arrays: const main = [ {name: "Karan", age: 34}, {name: "Aayush", ...

Read More
Showing 14791–14800 of 61,297 articles
Advertisements