Articles on Trending Technologies

Technical articles with clear explanations and examples

Does HTML5 only replace the video aspects of Flash/Silverlight?

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

HTML5 doesn't only replace video aspects of Flash/Silverlight—it provides comprehensive alternatives for graphics, animations, multimedia, and interactive content through several powerful technologies. What HTML5 Offers Beyond Video While HTML5's and elements replace Flash's multimedia capabilities, the element provides a complete drawing and animation platform using JavaScript. HTML5 Canvas Element The element creates a drawable region where you can render graphics, animations, and interactive content dynamically: Canvas Animation Example Here's a simple animation that demonstrates Canvas capabilities: const canvas = document.getElementById('animCanvas'); const ...

Read More

CSS padding-top property

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

The padding-top CSS property specifies the top padding of an element. It creates space between the element's content and its top border. This property accepts values in pixels, percentages, em units, or other CSS length units. Syntax padding-top: value; Values The padding-top property accepts the following values: Length values: px, em, rem, cm, etc. Percentage: Relative to the width of the containing block inherit: Inherits from parent element initial: Sets to default value (0) Example with Length Values ...

Read More

Clearing the elements of a Stack in Javascript

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 1K+ Views

Consider a simple stack class in JavaScript. We'll implement a clear method to remove all elements from the stack. Basic Stack Implementation class Stack { constructor(maxSize) { // Set default max size if not provided if (isNaN(maxSize)) { maxSize = 10; } this.maxSize = maxSize; ...

Read More

Explain Deep cloning an object in JavaScript with an example.

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 315 Views

Deep cloning creates a completely independent copy of an object, including all nested properties. Unlike shallow copying, changes to the cloned object don't affect the original. Shallow vs Deep Copy Problem With shallow copying, nested objects are shared between original and copy: Shallow Copy Problem let original = { name: "John", ...

Read More

How to exclude certain values from randomly generated array JavaScript

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

We need to create a function that generates an array of random numbers while excluding certain values. The function takes two arguments: the desired array length and an array of numbers to exclude. Requirements: Generate random numbers between 0 and 100 Exclude numbers present in the exclusion array No duplicate numbers in the result Example const absentArray = [44, 65, 5, 34, 87, 42, 8, 76, 21, 33]; const len = 10; const generateRandom = (len, absentArray) => { const randomArray = []; for(let i ...

Read More

Is it possible to display substring from object entries in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 345 Views

Yes, you can display substrings from object entries in JavaScript using Object.fromEntries() combined with string methods like substr() or substring(). This technique allows you to transform object keys while preserving their associated values. Syntax Object.fromEntries( Object.entries(object).map(([key, value]) => [key.substr(startIndex, length), value] ) ) Example: Extracting Substring from Object Keys const originalString = { "John 21 2010": 1010, "John 24 2012": 1011, "John 22 2014": ...

Read More

How to set column width and column count with JavaScript?

Vikyath Ram
Vikyath Ram
Updated on 15-Mar-2026 822 Views

To set the column width and column count in a single declaration, use the JavaScript columns property. This CSS property is a shorthand that combines column-width and column-count into one convenient declaration. Syntax element.style.columns = "width count"; // or element.style.columns = "width"; element.style.columns = "count"; Parameters width - Minimum width of each column (e.g., "100px", "10em") count - Number of columns (e.g., 2, 3, 4) Example The following example demonstrates how to change column layout dynamically using JavaScript: ...

Read More

How to draw a 3D sphere in HTML5?

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

To create a 3D sphere in HTML5, you need to use the canvas element along with mathematical calculations to plot points in 3D space and project them onto a 2D canvas. This involves creating vertices using spherical coordinates and rendering them as a wireframe or solid sphere. Basic Sphere Class Structure First, let's create a Point3D class and a sphere display function: 3D Sphere // Point3D class to represent ...

Read More

How to set the CSS margin properties in one declaration?

George John
George John
Updated on 15-Mar-2026 362 Views

The margin property defines the space around an HTML element. It is possible to use negative values to overlap content. It specifies a shorthand property for setting the margin properties in one declaration. Syntax margin: value; margin: top right bottom left; margin: top horizontal bottom; margin: vertical horizontal; Margin Value Patterns The margin property accepts 1 to 4 values with different behaviors: Values Result Example 1 value All sides same margin: 20px 2 values vertical | horizontal margin: 10px 5px 3 values top | horizontal ...

Read More

What is function chaining in JavaScript?

vineeth.mariserla
vineeth.mariserla
Updated on 15-Mar-2026 4K+ Views

Function chaining is a technique that allows you to call multiple methods on the same object in sequence using dot notation. This makes code more concise and improves readability by eliminating the need to repeatedly reference the same object. How Function Chaining Works For function chaining to work, each method must return the object itself (typically using return this). This allows the next method in the chain to be called on the returned object. Without Function Chaining In this example, the methods don't return this, so chaining is not possible: ...

Read More
Showing 17481–17490 of 61,297 articles
Advertisements