Articles on Trending Technologies

Technical articles with clear explanations and examples

How to set the painting area of the background with JavaScript?

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

In this tutorial, we will learn how to set the painting area of the background with JavaScript using the backgroundClip property. The background-clip CSS property defines how far a background (color or image) extends within an element. It specifies whether the background extends beneath the border-box, padding-box, or content-box of an element. Understanding background-clip Property The background-clip property accepts three main values: border-box - Background extends to the outer edge of the border (default) padding-box - Background extends to the outer edge of the padding content-box ...

Read More

How to set focus on a text input in a list with AngularJS and HTML5

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

To set focus on a text input in a list with AngularJS, you need to create a custom directive that observes a focus attribute and programmatically sets focus when the condition is met. Creating the Focus Directive First, create a custom directive that will handle the focus functionality: Focus state: {{cue.isNewest}} ...

Read More

Font size adjust of an element with CSS

Giri Raju
Giri Raju
Updated on 15-Mar-2026 272 Views

The font-size-adjust CSS property enables you to adjust the x-height to make fonts more legible when fallback fonts are used. It helps maintain consistent visual font sizes across different font families. Syntax font-size-adjust: none | number; Parameters none - Default value. No font size adjustment. number - A positive number that specifies the aspect ratio (x-height divided by font size). How It Works The property calculates: adjusted font size = specified font size × (font-size-adjust value ÷ aspect ratio of actual font) ...

Read More

Add sizes for Bootstrap Buttons

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 325 Views

Bootstrap provides several CSS classes to control button sizes, from large buttons to block-level buttons that span the full width of their container. Button Size Classes Class Description .btn-lg ...

Read More

No. of ways to empty an array in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 261 Views

JavaScript provides several methods to empty an array. Each method has different use cases and behaviors, especially when multiple references to the same array exist. Method 1: Setting to New Array This method creates a new empty array and assigns it to the variable. However, it doesn't affect other references to the original array. Setting to New Array let arr = [1, 2, 3, ...

Read More

Solution to the clumsy factorial problem in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 422 Views

Normally, the factorial of a positive integer n is the product of all positive integers less than or equal to n. For example, factorial(10) = 10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1. We instead make a clumsy factorial: using the integers in decreasing order, we swap out the multiply operations for a fixed rotation of operations: multiply (*), divide (/), add (+) and subtract (-) in this order. For example, clumsy(10) = 10 * 9 / 8 + 7 - 6 * 5 / 4 + ...

Read More

Add two array keeping duplicates only once - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 158 Views

When working with two arrays, you often need to merge them while keeping only unique values. This operation combines arrays and removes duplicates in a single step. const arr1 = [2, 4, 5, 3, 7, 8, 9]; const arr2 = [1, 4, 5, 2, 3, 7, 6]; We need to write a JavaScript function that takes two arrays and returns a new array with all duplicates removed (each element appears only once). Using Set with Spread Operator (Recommended) The most efficient approach uses ES6 Set to automatically remove duplicates: const arr1 = ...

Read More

Converting array to object by splitting the properties - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 304 Views

We have an array of string literals in which each element has a dash (-). The property key is present to the left of dash and its value to the right. A sample input array would look something like this: const arr = ["playerName-Kai Havertz", "age-21", "nationality-German", "position-CAM", "languages-German, English, Spanish", "club-Chelsea"]; We are required to write a function that splits these strings and form an object out of this array. Let's write the code. It will loop over the array splitting each string and feeding it into the new object. Using forEach Method ...

Read More

How to return a value from a JavaScript function?

Srinivas Gorla
Srinivas Gorla
Updated on 15-Mar-2026 3K+ Views

To return a value from a JavaScript function, use the return statement. The return statement sends a value back to the code that called the function and immediately exits the function. Syntax function functionName() { // function body return value; } Example: Basic Return Statement function concatenate(name, age) { var val = name + age; ...

Read More

For Hosts Locale how to convert a string to lowercase letters in JavaScript?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 15-Mar-2026 216 Views

To convert a string to lowercase letters in JavaScript, use the toLocaleLowerCase() method. This method converts characters to lowercase according to the host's locale, making it ideal for international applications. Syntax string.toLocaleLowerCase([locale]) Parameters locale (optional): A string specifying the locale to use for conversion. If omitted, the host environment's current locale is used. Basic Example Here's how to use toLocaleLowerCase() to convert a string to lowercase: var str ...

Read More
Showing 18841–18850 of 61,297 articles
Advertisements