Articles on Trending Technologies

Technical articles with clear explanations and examples

Total possible ways of making sum of odd even indices elements equal in array in nJavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 337 Views

We need to write a JavaScript function that counts how many elements can be removed from an array such that after removal, the sum of elements at odd indices equals the sum of elements at even indices. The approach involves calculating cumulative sums for odd and even positioned elements, then checking each removal scenario mathematically without actually removing elements. Problem Understanding Given an array, we want to find how many single element removals result in equal odd and even index sums in the remaining array. For example, with array [2, 6, 4, 2]: Remove index ...

Read More

Converting any case to camelCase in JavaScript

Revathi Satya Kondra
Revathi Satya Kondra
Updated on 15-Mar-2026 1K+ Views

In this article, we create a function that can take a string in any format. Such as normal case, snake case, pascal case or any other into camelCase in JavaScript. camelCase is a writing style where each word within a phrase is capitalized, except for the first word, and there are no spaces or punctuation. Let us understand through some sample example of I/O Scenario − Sample Input - const str = 'New STRING'; Sample Output - const output = 'newString'; Converting any case to camelCase in JavaScript Converting any ...

Read More

How to maintain stroke width of Ellipse while scaling using FabricJS?

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

In this tutorial, we are going to learn how we can maintain the stroke width of Ellipse while scaling using FabricJS. By default, the stroke width increases or decreases with respect to the object's scale values. However, we can disable this behaviour by using the strokeUniform property. Syntax new fabric.Ellipse({ strokeUniform: Boolean }: Object) Parameters options (optional) − This parameter is an Object which provides additional customizations to our ellipse. Using this parameter color, cursor, stroke width and a lot of other properties ...

Read More

How to create notes taking app using HTML, Bootstrap and JavaScript?

Kalyan Mishra
Kalyan Mishra
Updated on 15-Mar-2026 743 Views

In this tutorial, we will create a notes-taking app using HTML, Bootstrap, and JavaScript. HTML provides the structure, Bootstrap handles the styling and responsive design, and JavaScript adds functionality for adding, displaying, and deleting notes with persistent storage. Our application will feature a text area for entering notes, an "Add" button to save notes, and a dynamic list displaying all notes with delete functionality. We'll implement local storage to maintain notes even after page refreshes. Local Storage Overview Local Storage is browser storage that persists data on the user's computer. Unlike session storage, data remains available across ...

Read More

How do find out all elements that match a specific condition in JavaScript?

Aman Kumar
Aman Kumar
Updated on 15-Mar-2026 1K+ Views

In JavaScript, there are multiple ways to find elements that match specific conditions. While the underscore.js library provides the _.where() function, modern JavaScript also offers native methods like filter(), every(), and find(). Using _.where() from Underscore.js The _.where() function belongs to underscore.js, a JavaScript library that provides utility functions. It finds elements that match specified properties in an array of objects. Syntax _.where(list, properties) Parameters: list − The array to search through properties − Object containing the matching criteria Return value: An array containing ...

Read More

How to accept all pending connection requests on LinkedIn using JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 689 Views

To accept all pending connection requests on LinkedIn using JavaScript, you would need to use the LinkedIn API and an automation tool. The script would need to navigate to the connection request page and loop through each request, clicking the accept button for each one. This is a very common issue for people who are moderately to highly active on LinkedIn. They get many connection requests every day and must manually click on accept against each request to actually accept them. You can, however make use of JavaScript and the window console to automate this whole process and ...

Read More

How to create an array with random values with the help of JavaScript?

Tarun Singh
Tarun Singh
Updated on 15-Mar-2026 8K+ Views

In JavaScript, creating arrays filled with random values is a common requirement for simulations, games, and testing. The Math.random() method generates random numbers between 0 (inclusive) and 1 (exclusive), which can be combined with various array methods to create arrays of random values. Using Math.random() with For Loop The most straightforward approach uses a for loop with Math.random() to populate an array: Syntax // Random decimals between 0 and 1 for (let i = 0; i < arrayLength; i++) { randomArr.push(Math.random()); } // Random integers in a range for (let ...

Read More

Decimal count of a Number in JavaScript

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

Given there is a number with digits after decimal point and the task is to find the count of digits after the decimal point. Input Output Scenario Let's look into the input output scenario, where there is a floating point number having some digits after decimal point. Input = 45.36346323 Output = 8 As we can see in the above snippet there are 8 digits in the floating point number after the decimal point. To achieve this task, we'll explore three different methods using isInteger(), toString(), and split() methods. Method 1: Using ...

Read More

Finding word starting with specific letter in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 733 Views

Finding words that start with a specific letter is a common requirement in JavaScript applications. This guide shows different approaches to locate the first array element beginning with a specified character. Problem Statement We need to write a JavaScript function that takes an array of strings and a character, then returns the index of the first string starting with that character. Using substring() Method The substring() method extracts the first character for comparison: const names = ['Naman', 'Kartik', 'Anmol', 'Rajat', 'Keshav', 'Harsh', 'Suresh', 'Rahul']; const firstIndexOf = (arr = [], char = '') ...

Read More

Sorting numbers according to the digit root JavaScript

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

In this problem statement, our task is to sort numbers according to the digit root and implement this problem with the help of Javascript functionalities. So we can solve this problem with the help of loops in Javascript. What is digit root? The digit root of a given number is basically the sum of its digits. Repeat the calculation until the result is not a single digit. Let's take an example for the digit root, calculate the digit root for 1234, 1 + 2 + 3 + 4 = 10 = 1 + 0 = 1. Similarly the ...

Read More
Showing 14761–14770 of 61,297 articles
Advertisements