Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
CSS padding-bottom property
The padding-bottom CSS property specifies the bottom padding of an element. It sets the space between the element's content and its bottom border. This property accepts values in length units (px, em, rem) or percentages (%). Syntax padding-bottom: length | percentage | initial | inherit; Parameters length - Fixed value in units like px, em, rem (e.g., 10px, 1.5em) percentage - Relative to the width of the containing block (e.g., 5%) initial - Sets to default value (0) inherit - Inherits ...
Read MoreUsing methods of array on array of JavaScript objects?
JavaScript array methods work seamlessly with arrays of objects. These methods allow you to manipulate, search, and transform object arrays efficiently. Basic Array Methods on Object Arrays Common array methods like push(), pop(), and splice() work directly on arrays containing objects: Array Methods on Objects body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; ...
Read MoreJavaScript - Converting array of objects into object of arrays
In this article, we will learn to convert an array of objects into an object of arrays in JavaScript. When working with JavaScript, it's common to handle arrays of objects representing structured data. A frequent challenge is grouping these objects based on a shared property and transforming the result into a new data structure. Problem Statement The goal is to convert an array of objects into an object of arrays where the keys represent a specific property (e.g., roles) and the values are arrays of corresponding data (e.g., player names). Input const team = [ ...
Read MoreMake array numbers negative JavaScript
In JavaScript, you can convert all positive numbers in an array to negative while keeping already negative numbers unchanged. This is useful for data transformations where you need to invert positive values. Let's say we have the following array: const arr = [7, 2, 3, 4, 5, 7, 8, 12, -12, 43, 6]; We need to write a function that converts all positive numbers to negative while leaving negative numbers unchanged (like 4 to -4, 6 to -6, but -12 stays -12). Using Array.reduce() const arr = [7, 2, 3, 4, 5, ...
Read MoreConvert HTML table to array in JavaScript?
Converting an HTML table to an array in JavaScript involves extracting data from table cells and storing them in a structured format. This is commonly done using DOM manipulation methods or jQuery. HTML Table Structure Let's start with a sample HTML table: Name Age John 23 ...
Read MoreFinding the element larger than all elements on right - JavaScript
We are required to write a JavaScript function that takes in an array of numbers and returns a subarray that contains all the elements from the original array that are larger than all the elements on their right. Problem Understanding For each element in the array, we need to check if it's greater than every element that comes after it. If yes, include it in the result. The last element is always included since there are no elements to its right. Algorithm Approach We can solve this efficiently by traversing the array from right to left, ...
Read MoreWhat will happen if a semicolon is misplaced in JavaScript?
If a semicolon is misplaced in JavaScript, it can lead to unexpected behavior due to Automatic Semicolon Insertion (ASI). JavaScript automatically inserts semicolons at the end of statements, which can sometimes cause logical errors when semicolons are placed incorrectly. Common Semicolon Misplacement Issues The most common problem occurs when a semicolon is accidentally placed after control flow statements like if, for, or while. Example: Semicolon After if Statement var val1 = 10; ...
Read MoreHow to set the width of the rule between columns with JavaScript?
The columnRuleWidth property controls the thickness of the vertical line that appears between columns in a multi-column layout. This property works with CSS multi-column layouts created using column-count or column-width. Syntax element.style.columnRuleWidth = "value"; The value can be specified in pixels (px), ems, or keywords like thin, medium, or thick. Example #myID { column-count: 4; column-rule: 4px solid yellow; ...
Read MoreHow do we include the direction of text display in HTML?
Use the dir attribute in HTML to specify the text direction. This attribute controls whether text flows left-to-right (LTR) or right-to-left (RTL). Syntax content Attribute Values Value Description Use Case ltr Left-to-right English, French, German rtl Right-to-left Arabic, Hebrew, Urdu auto Browser determines direction Mixed language content Example Here's how to use the dir attribute for different text directions: Text Direction Example This is default left-to-right text. ...
Read MoreWhat HTML5 File.slice method actually doing?
The HTML5 Blob.slice() method creates a new Blob object containing a subset of data from the source Blob. It's particularly useful for processing large files in chunks or extracting specific portions of binary data. Syntax blob.slice(start, end, contentType) Parameters The slice() method accepts three optional parameters: start - Starting byte position (default: 0) end - Ending byte position (default: blob.size) contentType - MIME type for the new blob (default: empty string) Basic Example // Create a blob with text content var originalBlob = new ...
Read More