Articles on Trending Technologies

Technical articles with clear explanations and examples

How to implement merge sort in JavaScript?

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

The Merge Sort algorithm is a divide-and-conquer sorting technique that recursively divides an array into smaller subarrays until each contains a single element, then merges them back in sorted order. The algorithm works by continuously splitting the array in half until it cannot be divided further. Once we have individual elements, we merge them back together in a sorted manner, comparing elements from each subarray and placing them in the correct order. Input-output Scenario Consider an unsorted array that we want to sort using merge sort: Input = [12, 34, 11, 1, 54, 25, 67, ...

Read More

Explain Keyword driven framework.

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 15-Mar-2026 402 Views

Keyword driven framework is also known as table driven framework. Here we have a table where we describe the keywords or actions for the methods that have to be executed. Automation test scripts are developed based on the keywords or actions mentioned in excel. The automation testers need to extend the framework capabilities by updating or building newer keywords. Framework Structure People working on manual testing with lesser programming knowledge can use this framework. The main idea is to identify the keywords or actions and utilize them in excel maintained for that particular test scenario. Often this ...

Read More

How to convert an Image to blob using JavaScript?

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

Converting an image to a blob in JavaScript allows you to work with binary image data for file uploads, downloads, or processing. A blob (Binary Large Object) represents immutable binary data that can be read as text or binary data. What is a Blob? A blob is a file-like object that contains raw binary data. When you convert an image to a blob, you get access to properties like size and MIME type, making it useful for file operations. Using fetch() to Convert Image URL to Blob The most common approach is using the fetch API ...

Read More

How to find distance between items on array JavaScript?

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 15-Mar-2026 2K+ Views

In JavaScript, finding the distance between array items means calculating how many positions separate two elements. The distance is measured as the absolute difference between their index positions. Understanding the Problem Array distance represents the number of steps needed to move from one element to another. For example, in the array [1, 2, 3, 4, 5], the distance between elements 2 and 4 is 2 because their indices are 1 and 3 respectively, giving us |3 - 1| = 2. Basic Distance Calculation The simplest approach uses indexOf() to find element positions and calculates the absolute ...

Read More

Find the longest sub array of consecutive numbers with a while loop in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 403 Views

We are required to write a function with a while-statement that determines the length of the largest consecutive subarray in an array of positive integers. For instance, if we have an array like [6, 7, 8, 6, 12, 1, 2, 3, 4], the longest consecutive sequence is [1, 2, 3, 4] with length 4. Problem Understanding Let's look at some examples to understand the problem better: Input: [6, 7, 8, 6, 12, 1, 2, 3, 4] Consecutive sequence: [1, 2, 3, 4] Output: 4 Input: [5, 6, 1, 8, 9, 7] Consecutive ...

Read More

Assign multiple variables to the same value in JavaScript?

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

JavaScript allows you to assign the same value to multiple variables in a single statement using the assignment operator chaining technique. Syntax var variable1, variable2, variable3; variable1 = variable2 = variable3 = value; You can also declare and assign in one line: var variable1 = variable2 = variable3 = value; Example: Assigning Same Value to Multiple Variables var first, second, third, fourth, fifth; first = second = third = fourth = fifth = 100; console.log("first:", first); console.log("second:", second); console.log("third:", third); console.log("fourth:", fourth); console.log("fifth:", fifth); console.log("Sum of all values:", ...

Read More

What is oncontextmenu event in JavaScript?

usharani
usharani
Updated on 15-Mar-2026 543 Views

The oncontextmenu event in JavaScript triggers when a user right-clicks on an element, causing the context menu to appear. This event allows you to handle right-click interactions and can be used to customize or prevent the default context menu behavior. Syntax element.oncontextmenu = function() { // Handle right-click }; // Or using addEventListener element.addEventListener('contextmenu', function(event) { // Handle right-click }); Example: Basic Context Menu Event Here's how to handle the oncontextmenu event when a user right-clicks on an element: ...

Read More

How to search the querystring part of the href attribute of an area in JavaScript?

Ramu Prasad
Ramu Prasad
Updated on 15-Mar-2026 203 Views

To get the querystring from the href attribute of an area element, use the search property. This property returns the query portion of the URL, including the question mark. Syntax areaElement.search Return Value Returns a string containing the query portion of the href URL, including the leading question mark (?). Returns an empty string if no query parameters exist. Example ...

Read More

How to use style attribute to define style rules?

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 379 Views

The style attribute allows you to apply CSS rules directly to individual HTML elements. This is called inline CSS and provides element-specific styling with the highest specificity. Syntax Content Example: Basic Inline Styling Inline CSS Example This is inline CSS Styled div with multiple properties Example: Multiple Style Properties ...

Read More

How to access JavaScript properties?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 332 Views

In JavaScript, there are three main ways to access object properties. Each method has specific use cases and advantages depending on the situation. Three Methods to Access Properties Dot notation: object.property Square bracket notation: object['property'] Object destructuring: let {property} = object Method 1: Using Dot Notation The dot notation is the most common and readable way to access properties when the property name is known at compile time. ...

Read More
Showing 18541–18550 of 61,297 articles
Advertisements