Articles on Trending Technologies

Technical articles with clear explanations and examples

JavaScript union of two objects

Alshifa Hasnain
Alshifa Hasnain
Updated on 15-Mar-2026 785 Views

In this article, we will learn to calculate the union of two objects in JavaScript. The union of two objects results in a new object that contains all the properties of both objects. What is the Union of Two Objects? The union of two objects is the process of combining the properties of both objects into a single object. When properties have the same key, their values are merged together. For example Input − const obj1 = { name: "John", email: "john@email.com" }; const obj2 = { name: "Jane", email: "jane@email.com" }; ...

Read More

Capturing JavaScript error in Selenium.

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 15-Mar-2026 2K+ Views

We can capture JavaScript errors in Selenium WebDriver to identify console errors that appear in the browser's Developer Tools. These errors can occur due to functional issues on the page or performance problems caused by excessive logging. JavaScript errors are typically visible in the Console tab of browser Developer Tools and can impact application functionality. Selenium provides logging capabilities to capture and analyze these errors programmatically. Browser Developer Tools - Console Tab ...

Read More

Performing power operations on an array of numbers in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 476 Views

We need to write a JavaScript function that takes an array of integers with even length and performs a specific power operation to find two numbers whose squares sum to a calculated value. Problem Statement Given an array of integers with even length, we calculate: num = (arr[0]² + arr[1]²) × (arr[2]² + arr[3]²) × ... × (arr[n-2]² + arr[n-1]²) Our function should return an array [A, B] such that A² + B² = num. Example Walkthrough For array [1, 2, 3, 4]: First pair: 1² + 2² = 1 ...

Read More

How to crop an image along the X-axis using FabricJS?

Rahul Gurung
Rahul Gurung
Updated on 15-Mar-2026 2K+ Views

In this tutorial, we are going to learn how to crop an image along the x-axis using FabricJS. We can create an Image object by creating an instance of fabric.Image. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. In order to crop an image along the x-axis, we use the cropX property. Syntax new fabric.Image( element: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | String, { cropX: Number }: Object, callback: function) Parameters ...

Read More

Explain the purpose of the 'in' operator in JavaScript

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 317 Views

This tutorial will teach about the 'in' operator in JavaScript. There are many operators available in JavaScript, such as arithmetic operators to perform mathematical operations, assignment operators, equality operators, etc. The 'in' operator is also one of them, which we can use to find properties from the object. Before we start, let me ask you a question. Have you ever needed to check for the existence of the object's properties while coding with JavaScript? If yes, how did you deal with it? The answer is simple you can use the 'in' operator, which returns the Boolean value based on ...

Read More

Find array elements that are out of order in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 323 Views

Suppose we have an array of sorted numbers but some elements of the array are out of their sorted order. We are required to write a JavaScript function that takes in one such array and returns a subarray of all those elements that are out of order. Example The code for this will be − const arr = ["2", "3", "7", "4", "5", "6", "1"]; const findOutOfOrder = arr => { let notInOrder = []; notInOrder = arr.filter((el, ind) => { ...

Read More

Check for a self-dividing number in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 301 Views

A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is self-dividing because it's divisible by 1, 2, and 8. However, any number containing 0 cannot be self-dividing since division by zero is undefined. What Makes a Number Self-Dividing? A number qualifies as self-dividing if: It contains no zeros (since division by zero is impossible) The number is evenly divisible by each of its individual digits Examples 128: Self-dividing because 128 ÷ 1 = 128, 128 ÷ 2 = ...

Read More

Data manipulation with JavaScript

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

When working with data arrays, you often need to combine different datasets. This tutorial shows how to merge a months array with a cashflows array to create a complete dataset with all months represented. Problem Statement Suppose we have two arrays describing cashflow data: const months = ["jan", "feb", "mar", "apr"]; const cashflows = [ {'month':'jan', 'value':10}, {'month':'mar', 'value':20} ]; console.log("Months:", months); console.log("Cashflows:", cashflows); Months: [ 'jan', 'feb', 'mar', 'apr' ] Cashflows: [ { month: 'jan', value: 10 }, { month: 'mar', value: 20 ...

Read More

Finding reflection of a point relative to another point in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 447 Views

Point reflection, also known as point symmetry, is a geometric transformation where a point P is reflected across a midpoint Q to create a new point P' that is equidistant from Q but in the opposite direction. P(6, -4) Q(11, 5) ...

Read More

How to serialize a Polygon object using FabricJS?

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

We can create a Polygon object by creating an instance of fabric.Polygon. A polygon object can be characterized by any closed shape consisting of a set of connected straight line segments. Since it is one of the basic elements of FabricJS, we can also easily customize it by applying properties like angle, opacity etc. Serialization is the process of converting an object into a format which is suitable for transfer over a network, which in this case is the object representation. In order to create an Object representation of a Polygon object, we use the toObject method. This method ...

Read More
Showing 14491–14500 of 61,297 articles
Advertisements