karthikeya Boyini

karthikeya Boyini

1,420 Articles Published

Articles by karthikeya Boyini

Page 40 of 142

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

How to draw a 3D sphere in HTML5?

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 901 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

XMLHttpRequest for Video Tag?

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

XMLHttpRequest can be used to fetch video data as a blob and display it in HTML5 video elements. This approach is useful for loading video content programmatically or handling binary video data. Basic XMLHttpRequest with Blob First, let's understand how to send binary data using XMLHttpRequest with a Blob object: var xhr = new XMLHttpRequest(); xhr.open("POST", "/upload", true); xhr.onload = function (event) { console.log("Upload complete"); }; // Create a blob with text data var blob = new Blob(['demo content'], {type: 'text/plain'}); xhr.send(blob); Loading Video with XMLHttpRequest ...

Read More

Change the width of the bottom border with CSS

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

The border-bottom-width CSS property controls the thickness of an element's bottom border. This property only works when a border style is defined, as borders are invisible by default. Syntax border-bottom-width: value; Common values include thin, medium, thick, or specific measurements like 1px, 5px, 0.5em. Example This is demo content with a 6px bottom border. ...

Read More

Peeking elements from a Queue in Javascript

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

Peeking a Queue means getting the value at the head of the Queue without removing it. This allows you to inspect the next element that would be dequeued without modifying the queue structure. Syntax peek() { if (this.isEmpty()) { console.log("Queue Underflow!"); return; } return this.container[0]; } Complete Queue Implementation with Peek class Queue { constructor(maxSize) { ...

Read More

How to create or reset counters with JavaScript?

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

CSS counters provide a way to automatically number elements on a webpage. In JavaScript, you can create or reset counters using the counterReset property to control counter initialization and reset points. How CSS Counters Work CSS counters use three main properties: counter-reset - Creates or resets a counter counter-increment - Increments the counter value counter() - Displays the counter value in content Basic Counter Example body { ...

Read More

HTML5 Input type "number" in Firefox

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

The HTML5 input type "number" provides built-in validation and spinner controls for numeric input. However, browser support for certain attributes like min and max has varied across different versions of Firefox. Browser Support Overview Modern Firefox versions (52+) fully support the min and max attributes for number inputs. Earlier Firefox versions had limited support, but this is no longer an issue for current web development. Example Here's a complete example demonstrating the number input with validation attributes: HTML5 Number Input ...

Read More

How to control the shape or appearance of the marker with CSS?

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

The list-style-type CSS property allows you to control the shape or appearance of list markers in both ordered and unordered lists. This property provides various built-in marker styles to enhance your list presentations. Syntax list-style-type: value; Common Values for Unordered Lists List Style Types Circle Markers Apple Mango Grapes ...

Read More

Resize image before submitting the form HTML5

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

To resize an image before submitting a form in HTML5, you can use the HTML5 Canvas API with the drawImage() method. This allows you to scale images on the client-side before sending them to the server. Basic Approach The process involves loading the image into a canvas, scaling it using drawImage(), and then converting the canvas back to an image format for form submission. Syntax context.drawImage(img, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight); Parameters img - The image element to draw sx, sy - Source x and y coordinates (usually ...

Read More

Creating a Priority Queue using Javascript

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

A priority queue is a data structure where each element has a priority. Elements are removed based on their priority rather than insertion order. Here's how to implement one using JavaScript arrays. Priority Queue Structure Our priority queue class will include these essential methods: enqueue(element, priority): Add an element with a specific priority dequeue(): Remove and return the highest priority element peek(): Return the highest priority element without removing it isEmpty(): Check if the queue is empty isFull(): Check if the queue has reached capacity display(): Show all queue contents Basic Implementation Let's ...

Read More
Showing 391–400 of 1,420 articles
« Prev 1 38 39 40 41 42 142 Next »
Advertisements