Articles on Trending Technologies

Technical articles with clear explanations and examples

Cross-browser drag-and-drop HTML file upload?

Nishtha Thakur
Nishtha Thakur
Updated on 15-Mar-2026 382 Views

Cross-browser drag-and-drop file upload can be challenging due to browser differences. Modern browsers support the HTML5 File API, while legacy browsers require fallback solutions. HTML5 Drag and Drop API Modern browsers support native drag-and-drop using the HTML5 File API: Drop files here const dropZone = document.getElementById('dropZone'); // Prevent default drag behaviors ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { dropZone.addEventListener(eventName, preventDefaults, false); }); function preventDefaults(e) { e.preventDefault(); e.stopPropagation(); } // Handle drop dropZone.addEventListener('drop', handleDrop, false); ...

Read More

Effects and animations with Google Maps markers in HTML5

Samual Sam
Samual Sam
Updated on 15-Mar-2026 313 Views

Google Maps API doesn't provide built-in fade or animation effects for standard markers. However, you can create custom animations by implementing Custom Overlays that give you full control over marker appearance and behavior. Why Custom Overlays? Standard Google Maps markers have limited animation options. Custom overlays allow you to: Control opacity and CSS transitions Create fade in/out effects Add custom animations using CSS or JavaScript Implement bounce, slide, or rotation effects Creating a Custom Overlay Class // Custom overlay class extending Google Maps OverlayView function CustomMarker(position, map, content) { ...

Read More

Add elements to a hash table using Javascript

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

When adding elements to a hash table, the most crucial part is collision resolution. We're going to use chaining for the same. There are other algorithms you can read about here: https://en.wikipedia.org/wiki/Hash_table#Collision_resolution Now let's look at the implementation. We'll be creating a hash function that'll work on integers only to keep this simple. But a more complex algorithm can be used to hash every object. Hash Table Implementation First, let's create a complete hash table class with the necessary components: class HashTable { constructor(size = 11) { ...

Read More

Is 'floating-point arithmetic' 100% accurate in JavaScript?

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 15-Mar-2026 633 Views

In JavaScript, floating-point arithmetic is not 100% accurate due to how computers store decimal numbers in binary format. This leads to precision errors that can affect calculations involving decimal values. Understanding Floating Point Numbers A floating-point number is any number with a decimal point, such as 1.52, 0.14, or -98.345. In JavaScript, all numbers are stored using the IEEE 754 double precision format, which uses 64 bits to represent numbers. Sign Exponent (11 bits) Mantissa/Fraction (52 bits) ...

Read More

Reversing the prime length words - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 241 Views

We are required to write a JavaScript function that takes in a string that contains words joined by whitespaces. Our function should create a new string that has all the words from the original string, but words whose length is a prime number should be reversed (i.e., words with length 2, 3, 5, 7, 11, etc.). What are Prime Numbers? A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. For example: 2, 3, 5, 7, 11, 13, etc. Algorithm Our approach involves three main steps: ...

Read More

JavaScript: Finding nearest prime number greater or equal to sum of digits - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 229 Views

We are required to write a JavaScript function that takes in a number, finds the sum of its digits and returns a prime number that is just greater than or equal to the sum. Understanding the Problem For a number like 56563, we first calculate the sum of digits: 5 + 6 + 5 + 6 + 3 = 25. Since 25 is not prime (divisible by 5), we find the next prime number, which is 29. Example const num = 56563; const digitSum = (num, sum = 0) => { ...

Read More

How to get the arctangent of the quotient of its arguments in JavaScript?

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 293 Views

In this tutorial, we will learn how to get the arctangent of the quotient of its arguments in JavaScript. The JavaScript Math object provides built-in methods for mathematical operations. The Math.atan2() method is particularly useful for calculating the angle between two points in a coordinate system. Following are the ways to find the arctangent of the quotient of its arguments in JavaScript. Using Math.atan2() Method The Math.atan2() method returns a numeric value between -π and π representing the angle (in radians) between the positive x-axis and the point (x, y). Note that the y-coordinate is passed ...

Read More

How to name JavaScript Identifiers?

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

In this tutorial, we will learn how to name JavaScript Identifiers. Identifiers in JavaScript are the names we give to variables, arrays, objects, functions, etc. We must give them unique names to identify them properly. There are specific rules we must follow when naming identifiers that are common to most programming languages. Rules for Naming Identifiers There are certain rules we have to follow before naming an identifier. A proper name helps the programmer to make the code more effective. The rules are the following: JavaScript identifier names should not start with ...

Read More

How to attach one or more drop-shadows to the box with JavaScript?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 2K+ Views

To attach one or more drop shadows to a box with JavaScript, you can use the boxShadow style property. You can specify the shadow's horizontal offset, vertical offset, blur radius, spread radius, and color. Syntax Following is the syntax to add one or more drop shadows to the box with JavaScript: element.style.boxShadow = "offset-x offset-y blur-radius spread-radius color"; Parameters The boxShadow property accepts the following parameters: offset-x − Horizontal offset of the shadow. Positive values create a shadow on the right side, negative values on the left ...

Read More

HTML5 file uploading with multiple progress bars

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

HTML5 provides native file upload capabilities with progress tracking. When uploading multiple files, you can create individual progress bars for each file by leveraging the XMLHttpRequest progress events. The Challenge The main challenge is associating each XMLHttpRequest with its corresponding progress bar element. This requires storing a reference to the list item in the XMLHttpRequest object. Setting Up the Progress Tracking To track progress for multiple files, you need to bind each XMLHttpRequest to its corresponding list item element before starting the upload: Multiple File Upload with ...

Read More
Showing 18061–18070 of 61,297 articles
Advertisements