Articles on Trending Technologies

Technical articles with clear explanations and examples

What is the maximum size of a web browser's cookies value?

Daniol Thomas
Daniol Thomas
Updated on 15-Mar-2026 5K+ Views

The maximum size of cookies varies across different web browsers. Understanding these limitations is crucial for web developers to ensure proper cookie handling and avoid data loss. Browser Cookie Limits Web Browser Maximum Cookies per Domain Maximum Size per Cookie ...

Read More

How to check if a variable is boolean in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 30K+ Views

In JavaScript, determining if a variable is a boolean can be tricky because of type coercion. When using the equality operator (==), JavaScript converts values, so true == "true" returns true even though they're different types. To accurately check boolean types, we need specific methods. Here are three reliable approaches to check if a variable is a boolean: Using the typeof operator Using the strict equality operator (===) Using Object.prototype.toString.call() Using the typeof Operator The typeof operator returns a string indicating the ...

Read More

With JavaScript RegExp search a hexadecimal number character.

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 537 Views

To find a hexadecimal number character with JavaScript Regular Expression, use the \x escape sequence followed by the two-digit hexadecimal value. Syntax \xdd Where dd represents the two-digit hexadecimal value (00-FF) of the character you want to match. Example: Searching for Hexadecimal Character The following example searches for hexadecimal number 53, which represents the character 'S': JavaScript Regular Expression ...

Read More

How to set the top position of an element with JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 15K+ Views

In this tutorial, we shall learn to set the top position of an element with JavaScript. To set the top position of an element, we can use the DOM Style top property in JavaScript. Alternatively, we can use the DOM Style setProperty() method. Let us discuss our topic in brief. Using the Style top Property We can set or return the top position of an element using the JavaScript DOM style top property. Following is the syntax to set the top position of an element using the Style top property with the dot notation or square brackets. ...

Read More

Fat vs concise arrow functions in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 373 Views

Arrow functions in JavaScript come in two forms: fat arrow (with curly braces) and concise arrow (without curly braces). The concise form is a streamlined syntax for single-expression functions that provides implicit return functionality. Syntax Comparison Fat arrow function with explicit return: let add = (a, b) => { return a + b; } Concise arrow function with implicit return: let add = (a, b) => a + b; Single parameter (parentheses optional): let square = x => x * x; No parameters (parentheses required): ...

Read More

Smallest positive value that cannot be represented as sum of subarray JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 279 Views

We have a sorted array of positive integers like this: const arr = [1, 3, 6, 10, 11, 15]; We are required to write a function, say findSmallest() that takes in one such array and returns the smallest positive integer that cannot be represented as the sum of some subarray of this original array. For example, for the array written above, 2 is the smallest positive integer which cannot be reached by summing any subarray of this original array. Algorithm Approach Since the array is sorted, we can achieve the solution to this ...

Read More

Iteration of for loop inside object in JavaScript to fetch records with odd CustomerId?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 366 Views

In JavaScript, you can iterate through an array of objects using a for loop and filter records based on specific conditions. Here's how to fetch records with odd CustomerId values. Array of Objects Structure Let's start with an array containing customer objects: var customerDetails = [ { customerId: 101, customerName: "John" }, { customerId: 102, ...

Read More

Inserting element at falsy index in an array - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 302 Views

We are required to write an Array function, let's say, pushAtFalsy() The function should take in an array and an element. It should insert the element at the first falsy index it finds in the array. If there are no empty spaces, the element should be inserted at the last of the array. We will first search for the index of empty position and then replace the value there with the value we are provided with. Understanding Falsy Values In JavaScript, falsy values include: null, undefined, false, 0, "" (empty string), and NaN. However, since 0 ...

Read More

How to set the bottom padding of an element with JavaScript?

Abhinaya
Abhinaya
Updated on 15-Mar-2026 824 Views

To set the bottom padding of an element in JavaScript, use the paddingBottom property of the element's style object. This property allows you to dynamically modify the spacing between an element's content and its bottom border. Syntax element.style.paddingBottom = "value"; Where value can be specified in pixels (px), percentages (%), em units, or other valid CSS length units. Example Here's how to set the bottom padding of an element dynamically: #box { ...

Read More

Difference between MessageChannel and WebSockets in HTML5

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 306 Views

WebSockets and MessageChannel are both HTML5 communication technologies, but they serve different purposes. WebSockets enable real-time communication between browser and server, while MessageChannel facilitates secure communication between different browsing contexts within the same application. WebSockets Overview WebSockets provide bidirectional communication between browser and server over a single persistent connection. They're ideal for real-time applications like chat systems, live updates, and gaming. // WebSocket connection to server const socket = new WebSocket('wss://example.com/socket'); socket.onopen = function(event) { console.log('WebSocket connected'); socket.send('Hello Server!'); }; socket.onmessage = function(event) { ...

Read More
Showing 18901–18910 of 61,299 articles
Advertisements