Articles on Trending Technologies

Technical articles with clear explanations and examples

Explain about logical not(!) operator in detail with example in javascript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 294 Views

The logical NOT operator (!) is a unary operator that inverts boolean values. It returns true for falsy values and false for truthy values. Syntax !expression How It Works The NOT operator first converts the operand to a boolean value, then returns its opposite: If the operand is truthy, it returns false If the operand is falsy, it returns true Example with Boolean Values document.getElementById("boolean-demo").innerHTML = "!true = " + !true ...

Read More

How to get the application name and version information of a browser in JavaScript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 2K+ Views

JavaScript provides a navigator object that contains information about the browser. To get the application name and version information, the navigator object provides navigator.appName and navigator.appVersion properties respectively. Application Name of the Browser The navigator.appName property returns the application name of the browser. However, due to historical reasons, most modern browsers (Chrome, Firefox, Safari, Edge) return "Netscape" regardless of their actual name. Example document.write("Application Name: " + navigator.appName); Output Application Name: Netscape Browser Version Information The navigator.appVersion property provides ...

Read More

What is the use of sentry in javascript?

Ayush Gupta
Ayush Gupta
Updated on 15-Mar-2026 486 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 191 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 526 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 330 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
Showing 17071–17080 of 61,299 articles
Advertisements