karthikeya Boyini

karthikeya Boyini

1,421 Articles Published

Articles by karthikeya Boyini

Page 37 of 143

DOMException Failed to load because no supported source was found

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

The "DOMException Failed to load because no supported source was found" error occurs when media elements (video, audio) cannot load their source files. This is commonly caused by CORS restrictions, incorrect file paths, or unsupported formats. Common Causes This error typically happens due to: Cross-Origin Resource Sharing (CORS) restrictions Incorrect file paths or missing media files Unsupported media formats Server configuration issues Method 1: Setting crossOrigin for CORS When loading media from different domains, set the crossOrigin attribute to handle CORS restrictions: const ...

Read More

Blending two images with HTML5 canvas

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

To blend two images using HTML5 canvas, you need to manipulate pixel data from both images and combine them in equal proportions (50-50). This technique uses the canvas getImageData() and putImageData() methods. HTML Structure First, set up the HTML elements with the images and canvas: Blended image: window.onload = function () { var myImg1 = document.getElementById('myImg1'); var myImg2 = document.getElementById('myImg2'); var myCanvas = document.getElementById("canvas"); var ctx = myCanvas.getContext("2d"); // ...

Read More

The Doubly Linked List class in Javascript

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

A doubly linked list is a data structure where each node contains references to both the next and previous nodes, allowing bidirectional traversal. Here's a complete implementation of a DoublyLinkedList class in JavaScript. Complete Implementation class DoublyLinkedList { constructor() { this.head = null; this.tail = null; this.length = 0; } insert(data, position = this.length) { let node = new this.Node(data); ...

Read More

How to draw large font on HTML5 Canvas?

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

To draw large font text on HTML5 Canvas, you need to set the font size using the font property and use fillText() or strokeText() methods to render the text. Basic Syntax context.font = "size family"; context.fillText(text, x, y); context.strokeText(text, x, y); Example: Drawing Large Text Large Font Canvas var myCanvas = document.getElementById("myCanvas"); var ...

Read More

JSON. stringify( ) function in JavaScript

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

The JSON.stringify() method converts a JavaScript object or value to a JSON string. This is the reverse of JSON.parse() which converts JSON strings back to JavaScript objects. Syntax JSON.stringify(value, replacer, space) Parameters value: The JavaScript value to convert to JSON string (required) replacer: Function or array to transform values (optional) space: Number of spaces or string for indentation (optional) Basic Example JSON.stringify Example var obj = {Tutorial: "JavaScript", Version: "ES6", ...

Read More

Set Data Structure in Javascript

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

A Set is a built-in data structure in JavaScript that stores unique values of any type. Unlike arrays, Sets automatically prevent duplicate values and don't maintain insertion order for iteration purposes, making them ideal for storing collections of unique items. Creating a Set You can create a Set using the Set constructor: // Empty Set let emptySet = new Set(); console.log(emptySet); // Set with initial values let numbers = new Set([1, 2, 3, 4, 5]); console.log(numbers); // Set automatically removes duplicates let duplicates = new Set([1, 2, 2, 3, 3, 4]); console.log(duplicates); ...

Read More

Creating a Set using Javascript

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

In JavaScript, a Set is a collection of unique values. You can create sets using the native ES6 Set class or implement a custom set class. Let's explore both approaches. Creating Sets with ES6 Set Class The simplest way to create a set is using the built-in Set constructor: // Create empty set const set1 = new Set(); // Create set with initial values const set2 = new Set([1, 2, 5, 6]); console.log(set1); console.log(set2); Set(0) {} Set(4) { 1, 2, 5, 6 } Custom Set Implementation You can ...

Read More

How to set the boldness of the font with JavaScript?

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

Use the fontWeight property in JavaScript to set the font boldness. This CSS property accepts values like "normal", "bold", "bolder", "lighter", or numeric values from 100 to 900. Syntax element.style.fontWeight = value; Parameters The fontWeight property accepts the following values: Value Description "normal" Default weight (equivalent to 400) "bold" Bold weight (equivalent to 700) "bolder" Bolder than parent element "lighter" Lighter than parent element 100-900 Numeric values (100 = thinnest, 900 = boldest) Example: Setting Font Weight with ...

Read More

Is their a cross-origin attribute in HTML5?

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

Yes, HTML5 includes the crossorigin attribute. According to the official specification, it's defined as: The crossorigin attribute is a CORS settings attribute. Its purpose is to allow images from third-party sites that allow cross-origin access to be used with canvas. Syntax Supported Values The crossorigin attribute accepts two values: Value Description Credentials Sent? anonymous Performs CORS request without credentials No use-credentials Performs CORS request with credentials Yes Example: Canvas Image Access ...

Read More

Remove elements from a Set using Javascript

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

JavaScript Sets provide methods to remove elements efficiently. The primary method is delete(), which removes a specified value from the Set. Using the delete() Method The delete() method removes a value from the Set and returns true if the value existed, or false if it didn't. Syntax set.delete(value) Example: Removing Individual Elements const mySet = new Set([1, 2, 3, 4, 5]); console.log("Original Set:", mySet); // Remove elements console.log("Delete 3:", mySet.delete(3)); // true - existed console.log("Delete 10:", mySet.delete(10)); // false - didn't exist console.log("Updated Set:", mySet); console.log("Set size:", ...

Read More
Showing 361–370 of 1,421 articles
« Prev 1 35 36 37 38 39 143 Next »
Advertisements