Articles on Trending Technologies

Technical articles with clear explanations and examples

How to detect the screen resolution with JavaScript?

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

To detect the screen resolution in JavaScript, you can use the window.screen object, which provides properties to access display dimensions and available screen space. Screen Properties Overview The window.screen object offers several useful properties: screen.width and screen.height - Total screen dimensions screen.availWidth and screen.availHeight - Available screen space (excluding taskbars) Basic Screen Resolution Detection Screen Resolution Detection ...

Read More

Flattening an array with truthy/ falsy values without using library functions - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 226 Views

We need to write a JavaScript function that takes a nested array containing falsy values and returns a completely flattened array. This means converting a multi-dimensional array into a single-dimensional array while preserving all elements, including falsy values like false, null, and 0. For example, if the input is: const arr = [[1, 2, 3], [4, 5, [5, false, 6, [5, 8, null]]], [6]]; The output should be: [1, 2, 3, 4, 5, 5, false, 6, 5, 8, null, 6] Method 1: Using Recursive Function with Array.prototype Extension We can ...

Read More

Find a form feed character with JavaScript RegExp.

Sravani Alamanda
Sravani Alamanda
Updated on 15-Mar-2026 1K+ Views

Form feed character is a page breaking ASCII control character commonly used for page separators. When you want to insert a page break, text editors can use this form feed. It is defined as \f and has an ASCII code value of 12 or 0x0c. RegExp is an object that specifies the pattern used to perform search and replace operations on strings or for input validation. RegExp was introduced in ES1 and is fully supported by all browsers. Now, we will check how to find the form feed (\f) character in given text using RegExp. Syntax ...

Read More

How to set whether or not an element is resizable by the user with JavaScript?

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

In this tutorial, we will learn to set whether or not an element is resizable by the user with JavaScript. The CSS resize property controls if users can drag element corners to change its size. Web elements are typically fixed in position and size. However, sometimes you need to allow users to resize elements dynamically. The CSS resize property provides this functionality, and JavaScript's DOM manipulation allows us to control this behavior programmatically. Using the Style resize Property The resize property determines whether an element can be resized by the user. Common examples include textarea elements, which ...

Read More

Strange cursor placement in modal when using autofocus in Internet Explorer with HTML

Samual Sam
Samual Sam
Updated on 15-Mar-2026 228 Views

Internet Explorer has a known issue where autofocused elements in fading modals cause strange cursor placement. The cursor may appear in unexpected positions or behave erratically when the modal opens. The Problem When using Bootstrap modals with the autofocus attribute on input elements, IE places the cursor incorrectly during the fade transition. This happens because IE handles CSS transitions and focus events differently than other browsers. Solution 1: Modify CSS Transition Override the default modal transition to use only opacity changes: .modal.fade { transition: opacity .3s linear; } ...

Read More

Usage of font-variant property in CSS

Sreemaha
Sreemaha
Updated on 15-Mar-2026 142 Views

The CSS font-variant property controls typographic variations of text, primarily creating small-caps effects where lowercase letters appear as smaller uppercase letters. Syntax font-variant: normal | small-caps | initial | inherit; Values normal - Default value, displays text normally small-caps - Converts lowercase letters to smaller uppercase letters initial - Sets to default value inherit - Inherits from parent element Example: Small Caps Effect .normal-text { ...

Read More

Difference between Procedural and Declarative Knowledge

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 15-Mar-2026 24K+ Views

We can express the knowledge in various forms to the inference engine in the computer system to solve the problems. There are two important representations of knowledge namely, procedural knowledge and declarative knowledge. The basic difference between procedural and declarative knowledge is that procedural knowledge gives the control information along with the knowledge, whereas declarative knowledge just provides the knowledge but not the control information to implement the knowledge. Read through this article to find out more about procedural knowledge and declarative knowledge and how they are different from each ...

Read More

Passing parameters to callback functions JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 625 Views

Callback functions in JavaScript can accept parameters just like regular functions. When passing a callback to another function, you can provide parameters that the callback will use when executed. Basic Callback with Parameters A callback function receives parameters when it's invoked by the calling function: Callback Parameters Run Example function add2(a) { ...

Read More

Searching objects by value in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 331 Views

When working with complex JavaScript objects, you often need to find all keys that contain a specific value. This is particularly useful for nested objects where the same value might appear at multiple levels. Consider this example object with nested structure: const obj = { "name": "Vivek Sharma", "occupation": "Software Engineer", "age": 23, "contacts": [{ "name": "Mukul Sharma", "occupation": "Software Engineer", ...

Read More

Split number into n length array - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 513 Views

We are required to write a JavaScript function that takes in two numbers say m and n, and returns an array of size n with all the elements of the resulting array adding up to m. Let's write the code for this function − Example Following is the code − const len = 8; const sum = 5; const splitNumber = (len, sum) => { const res = []; for(let i = 0; i < len; i++){ res.push(sum / ...

Read More
Showing 18861–18870 of 61,299 articles
Advertisements