Articles on Trending Technologies

Technical articles with clear explanations and examples

Underline text with CSS

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

Use the text-decoration property to underline text with CSS. This property provides several options for decorating text, with underline being one of the most commonly used values. Syntax text-decoration: underline; Basic Example India Different Underline Styles You can customize the underline appearance using additional properties: ...

Read More

LCM of an array of numbers in Java

George John
George John
Updated on 15-Mar-2026 4K+ Views

L.C.M. or Least Common Multiple of two values, is the smallest positive value which is a multiple of both values. For example, multiples of 3 and 4 are: 3 → 3, 6, 9, 12, 15 ... 4 → 4, 8, 12, 16, 20 ... The smallest common multiple is 12, hence the LCM of 3 and 4 is 12. Understanding LCM of Array To find the LCM of an array of numbers, we can use the mathematical relationship: LCM(a, b) = (a × b) / GCD(a, b). For multiple numbers, we calculate LCM iteratively. ...

Read More

JavaScript Determine the array having majority element and return TRUE if its in the same array

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 210 Views

We are required to write a JavaScript function that takes in an array of numbers with repetitive values and returns the number that appears for more than (n/2) number of times where n is the length of the array. If there is no such element in the array, our function should return false. This problem is commonly known as finding the "majority element" in an array. A majority element is one that appears more than half the time in the array. Algorithm Approach We'll use the Boyer-Moore Voting Algorithm, which works in two phases: ...

Read More

Method to check if array element contains a false value in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 254 Views

To check if an array element contains a false value in JavaScript, you can use methods like some(), includes(), or Object.values() depending on your data structure. Using some() for Simple Arrays The some() method tests whether at least one element passes a test function: const booleanArray = [true, false, true]; const hasfalseValue = booleanArray.some(value => value === false); console.log("Array contains false:", hasfalseValue); // Or more simply const hasFalse = booleanArray.includes(false); console.log("Using includes():", hasFalse); Array contains false: true Using includes(): true Using Object.values() for Nested Objects For complex nested structures, ...

Read More

Implement divide & conquer logic in JavaScript to implement QuickSort

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 700 Views

We are required to write a JavaScript function that takes in an array of numbers and uses the quick sort algorithm to sort it. QuickSort Algorithm QuickSort is a divide and conquer algorithm that works by selecting a 'pivot' element from the array and partitioning other elements into two sub-arrays according to whether they are less than or greater than the pivot. The sub-arrays are then sorted recursively. How It Works The algorithm follows these steps: Choose a pivot element (typically the middle element) Partition the array so elements smaller than pivot go to the ...

Read More

Removing identical entries from an array keeping its length same - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 197 Views

We have to write a function that takes in an array, removes all duplicates from it and inserts the same number of empty strings at the end. For example − If we find four duplicate values, we have to remove them all and insert four empty strings at the end. Understanding the Problem The goal is to: Remove duplicate elements from the array Keep only the last occurrence of each element Maintain the original array length by adding empty strings Example ...

Read More

UIWebView HTML5 Canvas & Retina Display

Vrundesha Joshi
Vrundesha Joshi
Updated on 15-Mar-2026 245 Views

When working with HTML5 Canvas on retina displays in UIWebView, images may appear blurry due to pixel density differences. Here's how to properly handle retina displays for crisp canvas rendering. The Retina Display Problem Retina displays have higher pixel density (devicePixelRatio > 1), but Canvas elements default to standard resolution, causing blurry images and drawings. Solution: Scale Canvas for Retina The key is to scale the canvas context and adjust its internal dimensions to match the device's pixel ratio: var canvas = document.getElementById('myCanvas'); var context = canvas.getContext('2d'); var width = 300; ...

Read More

Strikethrough text with CSS

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 15-Mar-2026 1K+ Views

Use the text-decoration property to create strikethrough text with CSS. The line-through value draws a horizontal line through the middle of the text. Syntax text-decoration: line-through; Basic Example This text will be striked through. Using CSS Classes For better organization, use CSS classes instead of inline styles: ...

Read More

Combining multiple images into a single one using JavaScript

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

JavaScript's Canvas API allows you to combine multiple images into a single composite image. This technique is useful for creating overlays, watermarks, or blending effects in web applications. How Canvas Image Combining Works The process involves loading images into a canvas element and using the drawImage() method with different alpha transparency values to create layered effects. Example: Overlaying Two Images Combining Multiple Images body { ...

Read More

Check if input is a number or letter in JavaScript?

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

JavaScript provides several methods to check if an input is a number or letter. The most common approach uses the isNaN() function, which returns true if the value is "Not a Number". Using isNaN() Function The isNaN() function converts the input to a number and checks if it's NaN (Not a Number): Check Number or Letter Enter the value: ...

Read More
Showing 18961–18970 of 61,297 articles
Advertisements