Articles on Trending Technologies

Technical articles with clear explanations and examples

What is the use of sentry in javascript?

Ayush Gupta
Ayush Gupta
Updated on 15-Mar-2026 422 Views

Sentry is a complete JavaScript debugging and monitoring tool that helps developers track errors and performance issues in production applications. It provides real-time error tracking, performance monitoring, and detailed debugging information to improve application reliability. Key Features of Sentry Record environment and usage details to recreate and fix bugs See the error and stack trace previously only visible in user's debug console Apply source maps automatically to convert minified, compiled, or transpiled code back to its original form Mobile app reporting support ...

Read More

How to read data from JSON array using JavaScript?

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

JSON arrays are a common data structure in JavaScript applications. This article demonstrates various methods to read and access data from JSON arrays. What is a JSON Array? A JSON array is a collection of JSON objects enclosed in square brackets. Each object can contain multiple key-value pairs. [ {"name": "Rohan", "age": 22}, {"name": "Shawn", "age": 12}, {"name": "Michael", "age": 21} ] Method 1: Using JSON.parse() and forEach() The most common approach is parsing the JSON string and iterating through the array: ...

Read More

What should be the correct Algorithm to Get Array B from Array A counting backwards from the last element in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 147 Views

Consider the following binary array (Array A) − const arr = [1, 0, 1, 1, 1, 1, 0, 1, 1]; When this array is passed through the function, say sumRight(), it produces the following output array (Array B) − const output = [1, 0, 4, 3, 2, 1, 0, 2, 1]; Understanding the Algorithm Elements in array arr can be either 0 or 1. The function counts backward from the last element of array arr, if there are consecutive 1's in the array arr then the corresponding element in the output ...

Read More

Wildcard matching of string JavaScript

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

We are required to write a JavaScript function that accepts two strings and a number n. The function matches the two strings i.e., it checks if the two strings contains the same characters. The function should return true if both the strings contain the same character irrespective of their order or if they contain at most n different characters, otherwise the function should return false. Let's write the code for this function — Example const str1 = 'first string'; const str2 = 'second string'; const wildcardMatching = (first, second, num) => { ...

Read More

How to remove the first character of link (anchor text) in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 477 Views

In JavaScript, you can remove the first character from link anchor text using the substring(1) method combined with DOM manipulation. This is useful when you need to programmatically fix incorrectly formatted link text. The Problem Sometimes links may have extra characters at the beginning that need to be removed. For example, "Aabout_us" should be "about_us" and "Hhome_page" should be "home_page". Using substring(1) Method The substring(1) method extracts characters from index 1 to the end, effectively removing the first character (index 0). ...

Read More

Maximum Possible Sum of Products in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 251 Views

We are given two arrays say, arr1 and arr2 of positive numbers. The number of values in both the arrays are the same. We are required to write a function that finds the maximum sum of products of their elements. Each element in arr1 has to be multiplied with exactly one element in arr2 and vice versa such that each element of both the arrays appears exactly once and the sum of product produced is maximum. Problem Understanding For example: if, arr1 = [5, 1, 3, 4, 2] and, arr2 = [8, 10, 9, 7, ...

Read More

How to format hexadecimal Number in JavaScript?

Giri Raju
Giri Raju
Updated on 15-Mar-2026 2K+ Views

JavaScript provides several methods to format hexadecimal numbers. The most common approach is using toString(16) to convert numbers to hexadecimal format, then applying padding and formatting as needed. Basic Hexadecimal Conversion The toString(16) method converts a number to its hexadecimal representation: let num = 255; let hex = num.toString(16); document.write("Number: " + num + ""); document.write("Hexadecimal: ...

Read More

How to convert Boolean to Number in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 5K+ Views

In JavaScript, Boolean values (true and false) can be converted to numbers (1 and 0 respectively) using several methods. This conversion is useful when performing mathematical operations or comparisons that require numeric values. JavaScript provides multiple approaches to convert Boolean values to numbers. Let's explore three effective methods with examples. Using the Number() Function The Number() function is the most explicit and readable way to convert Boolean values to numbers. It converts true to 1 and false to 0. Syntax let result = Number(booleanValue); Example ...

Read More

How to set the color of the left border with JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 771 Views

In this tutorial, we will learn how to set the color of the left border with JavaScript. To set the color of the left border in JavaScript, use the borderLeftColor property. Set the color on this property that you want for the border. We could also apply the borderColor property to set the color of the left border. A border is an HTML element's outline. Different sides can be set with different border colors. To set the color of the left border with JavaScript, we have different ways − Using the style.borderLeftColor property ...

Read More

How to either determine SVG text box width or force line breaks after 'x' characters?

Krantik Chavan
Krantik Chavan
Updated on 15-Mar-2026 329 Views

When working with SVG text elements, you often need to control text wrapping since SVG doesn't automatically wrap text like HTML. This tutorial shows how to measure text width using getBBox() and implement word wrapping. The Problem SVG text elements don't wrap automatically. Long text will extend beyond boundaries, requiring manual line breaks based on width measurements. Using getBBox() for Text Measurement The getBBox() method returns the bounding box dimensions of SVG elements, including text width and height. ...

Read More
Showing 17071–17080 of 61,297 articles
Advertisements