Articles on Trending Technologies

Technical articles with clear explanations and examples

Including an external stylesheet file in your HTML document

varma
varma
Updated on 15-Mar-2026 649 Views

The element can be used to include an external style sheet file in your HTML document. An external style sheet is a separate text file with .css extension. You define all the Style rules within this text file and then you can include this file in any HTML document using element. Creating an External CSS File Consider a simple style sheet file with a name new.css having the following rules: h1, h2, h3 { color: #36C; font-weight: normal; letter-spacing: .4em; ...

Read More

Explain in detail about Mark and Sweep algorithm in JavaScript?

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

Mark and Sweep Algorithm The Mark and Sweep algorithm is JavaScript's primary garbage collection method that identifies objects "which are unreachable" rather than objects "which are no longer needed". This algorithm is an improvement over the Reference-counting algorithm and solves the circular reference problem. How Mark and Sweep Works The algorithm operates in three important steps: Root Identification: The algorithm starts from "roots" - global variables accessible in the code. In browsers, the window object acts as the primary root. Marking Phase: The algorithm traverses from roots to find ...

Read More

Merge sort vs quick sort in Javascript

Lokesh Yadav
Lokesh Yadav
Updated on 15-Mar-2026 795 Views

Merge Sort and Quick Sort are two popular divide-and-conquer sorting algorithms in JavaScript. While both are efficient, they differ in their approach, stability, and performance characteristics. Merge Sort Overview Merge Sort is a stable sorting algorithm that recursively divides the array into halves until each sub-array contains a single element, then merges them back in sorted order. It guarantees O(n log n) time complexity in all cases but requires additional space for merging. Quick Sort Overview Quick Sort selects a pivot element and partitions the array around it, placing smaller elements to the left and larger ...

Read More

State differences between Data Driven and Keyword Driven Framework.

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

Data Driven and Keyword Driven frameworks are two popular approaches in test automation. Understanding their differences helps choose the right framework for your testing needs. Data Driven Framework In data driven testing, we run tests on multiple data sets using parameterization. The data acts as input to the test script logic, with each data set representing a separate test case. The framework revolves around data maintained in external files (Excel, CSV, JSON) which is updated for individual test cases without changing the core test script logic. Example: Data Driven Login Test // Sample data ...

Read More

File and FileReader in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 413 Views

The File and FileReader APIs in JavaScript allow web applications to read and process files selected by users. The File object represents file information, while FileReader enables reading file contents asynchronously. File Object Properties When a user selects a file through an input element, you get access to a File object with these key properties: name - The file's name size - File size in bytes type - MIME type of the file lastModified - Last modification timestamp FileReader Methods FileReader provides several methods to read file contents: readAsText() - Reads ...

Read More

Simplifying nested array JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 436 Views

Let's say, we have an array of arrays that contains some elements like this − const arr = [3, 5, 7, 2, [4, NaN, null, 4, 8, [3, undefined, 24, null], null, 5, 1], NaN, 45, 2, 1]; Our job is to write a recursive function that takes in this nested array and replaces all the falsy values inside the array (NaN, undefined and null) with 0. Understanding Falsy Values In JavaScript, falsy values include: null undefined NaN ...

Read More

Creating an associative array in JavaScript?

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

In JavaScript, there's no true associative array like in other languages. Instead, you use objects or arrays of objects to achieve similar functionality. JavaScript objects act as associative arrays where you can use string keys to access values. What are Associative Arrays? Associative arrays use named keys instead of numeric indexes. In JavaScript, regular arrays have numeric indexes, but objects provide key-value pairs that function like associative arrays. Method 1: Using Objects The most common approach is using plain JavaScript objects: // Creating an associative array using object var customer = { ...

Read More

Inverting signs in array - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 630 Views

We are required to write a JavaScript function that takes in an array of positive as well as negative Numbers and changes the positive numbers to corresponding negative numbers and the negative numbers to corresponding positive numbers in place. Let's write the code for this function — Example Following is the code — const arr = [12, 5, 3, -1, 54, -43, -2, 34, -1, 4, -4]; const changeSign = arr => { arr.forEach((el, ind) => { arr[ind] *= -1; ...

Read More

How to get the hash part of the href attribute of an area in JavaScript?

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

In this tutorial, we will learn how to get the hash part of the href attribute of an area in JavaScript. The HTML element establishes an area within an image map with predetermined clickable zones. An image map allows you to correlate geometric regions of a picture with hypertext links. This element can only be used within the element. The href property gives the area's hyperlink target. The element is not a hyperlink if the href attribute is not present. Following is a method used to get the href attribute's hash part of an ...

Read More

Rules to override Style Sheet Rule in CSS

varun
varun
Updated on 15-Mar-2026 3K+ Views

CSS follows a specific hierarchy when multiple styles are applied to the same element. Understanding the cascade and specificity rules helps you control which styles take precedence. CSS Cascade Priority Order CSS applies styles based on the following priority order, from highest to lowest: Inline styles - Styles applied directly to HTML elements using the style attribute Internal stylesheets - Styles defined within tags in the HTML document External stylesheets - Styles defined in separate CSS files linked to the HTML document Example: Style Override Hierarchy ...

Read More
Showing 18561–18570 of 61,297 articles
Advertisements