Articles on Trending Technologies

Technical articles with clear explanations and examples

Search Element in an Javascript Hash Table

Sai Subramanyam
Sai Subramanyam
Updated on 15-Mar-2026 480 Views

JavaScript hash tables use a get method to search for elements by their key. The method calculates the hash code and searches through the chain at that index to find the matching key-value pair. The get() Method Implementation The search operation involves computing the hash code for the given key and then iterating through the chain at that bucket to find the exact match: get(key) { let hashCode = hash(key); for(let i = 0; i < this.container[hashCode].length; i ++) { ...

Read More

Explain touch events in JavaScript

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

Touch events in JavaScript are fired when a user interacts with a touchscreen device. These events provide a way to handle touch-based interactions on mobile devices, tablets, and other touch-enabled screens. Touch Event Types JavaScript provides four main touch events for handling different stages of touch interaction: Event Description ...

Read More

The image() object in JavaScript.

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

The Image object in JavaScript represents an HTML element and allows you to create, manipulate, and load images dynamically without adding them directly to the HTML. Creating Image Objects You can create an Image object using the new Image() constructor, optionally specifying width and height: // Basic image creation let img = new Image(); // With dimensions let imgWithSize = new Image(300, 200); Properties The Image object has several important properties: src - Sets or gets the image URL width - Sets or ...

Read More

JavaScript outsider function call and return the result

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 228 Views

In JavaScript, you can call functions from outside their defining scope by using the return keyword to return inner functions. This creates closures that maintain access to outer variables. Syntax function outerFunction() { // Outer variables var outerVar = value; // Inner function var innerFunction = function() { // Can access outerVar return result; } ...

Read More

Finding special type of numbers - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 246 Views

In the decimal number system, all the real numbers can be divided into two groups: Rational Numbers Irrational Numbers For the scope of this problem we will only discuss the rational numbers. All those numbers which can be written in the p/q form (where q ≠ 0) are called rational numbers, like 14, 4.6, 3.33333... and many more. The rational numbers can further be divided into two groups: Terminating decimal numbers Repeating decimal numbers This categorization is made on the basis ...

Read More

How to get the smallest integer greater than or equal to a number in JavaScript?

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

In this tutorial, we will learn how to get the smallest integer greater than or equal to a number in JavaScript. To get the smallest integer greater than or equal to a number, use the JavaScript Math.ceil() method. This method returns the smallest integer greater than or equal to a given number by rounding up to the nearest integer. The Math.ceil() method is a static function of the Math object and must be invoked as Math.ceil(). It always rounds numbers upward, making it perfect for finding the ceiling value of any number. Syntax Math.ceil(value) ...

Read More

How to set the maximum width of an element with JavaScript?

Samual Sam
Samual Sam
Updated on 15-Mar-2026 2K+ Views

The maxWidth property in JavaScript allows you to set the maximum width of an element dynamically. This property controls how wide an element can grow, which is particularly useful for responsive layouts and content that needs width constraints. Syntax element.style.maxWidth = "value"; The value can be specified in pixels (px), percentages (%), em, rem, or other valid CSS units. Example: Setting Maximum Width #box { ...

Read More

HTML5 File API readAsBinaryString reads files as much larger and different than files on disk

Ankith Reddy
Ankith Reddy
Updated on 15-Mar-2026 194 Views

When using HTML5 File API's readAsBinaryString() method, the resulting binary string can appear much larger than the original file due to character encoding issues and inefficient string representation of binary data. The Problem with readAsBinaryString The readAsBinaryString() method converts binary data to a string format, which can cause size inflation and encoding problems. This is especially problematic when manually creating multipart/form-data requests. Recommended Solution: Use FormData with File Objects Instead of reading files as binary strings, use FormData with the original File objects. This preserves the file's binary integrity and size. ...

Read More

Remove elements from Javascript Hash Table

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

To remove elements from a JavaScript hash table, we need to locate the element using its key and remove it from the underlying storage structure. In hash tables that use chaining for collision resolution, this involves searching through the chain at the computed hash index. Let us look at the implementation of the remove method: Remove Method Implementation remove(key) { let hashCode = this.hash(key); for (let i = 0; i < this.container[hashCode].length; i++) { // Find the element in ...

Read More

How to remove existing HTML elements in JavaScript?

Lokesh Yadav
Lokesh Yadav
Updated on 15-Mar-2026 47K+ Views

This article discusses how to delete existing HTML elements in JavaScript. To remove HTML elements, you first need to select the element from the document, then use methods like remove() and removeChild() to delete them from the DOM. Using the remove() Method The remove() method directly removes an element from the DOM. It's the simplest approach for modern browsers. Syntax element.remove(); Example Remove Element Example This heading will be removed This paragraph will remain ...

Read More
Showing 18071–18080 of 61,297 articles
Advertisements