Articles on Trending Technologies

Technical articles with clear explanations and examples

JavaScript DataView()

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 243 Views

The JavaScript DataView provides a low-level interface for reading and writing multiple number types in binary ArrayBuffer. You cannot manipulate ArrayBuffer directly without using DataView(). Syntax new DataView(buffer) new DataView(buffer, byteOffset) new DataView(buffer, byteOffset, byteLength) Parameters buffer - The ArrayBuffer to create a view for byteOffset - (Optional) Starting byte offset, default is 0 byteLength - (Optional) Number of bytes to include, default is buffer's length Basic Example DataView Example Run ...

Read More

Converting a proper fraction to mixed fraction - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 546 Views

A proper fraction is one where the numerator is smaller than the denominator, represented in p/q form where both p and q are natural numbers. What is a Mixed Fraction? When we divide the numerator (a) of a fraction by its denominator (b), we get a quotient (q) and remainder (r). The mixed fraction form for fraction a/b is: Mixed form: q r b This is pronounced as "q wholes and r by b". Problem Statement We need to write a ...

Read More

Check whether a string ends with some other string - JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 214 Views

In JavaScript, there are multiple ways to check if a string ends with another string. The most straightforward approach is using the built-in endsWith() method, though you can also implement custom solutions. Using String.endsWith() (Recommended) The endsWith() method is the standard way to check if a string ends with a specific substring: const str1 = 'this is just an example'; const str2 = 'ample'; console.log(str1.endsWith(str2)); // true console.log(str1.endsWith('temple')); // false console.log(str1.endsWith('example')); // true true false true Custom Implementation ...

Read More

How to include inline JavaScript inside an HTML page?

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

In this tutorial, we will learn how to include inline JavaScript inside an HTML page. Inline JavaScript allows you to write JavaScript code directly within HTML event attributes, making it useful for simple interactions without external script files. Using Inline JavaScript to Show an Alert Message One of the simplest ways to understand inline JavaScript is by using the alert method. The alert method opens a pop-up window containing a message. Inline JavaScript code is written within event attributes and executes when that event is triggered. Syntax // inline JavaScript within the onclick attribute of ...

Read More

How much should be a JavaScript Line Length?

Nitya Raut
Nitya Raut
Updated on 15-Mar-2026 845 Views

JavaScript line length refers to how many characters should fit on a single line of code. Following proper line length guidelines makes your code more readable and maintainable. Recommended Line Length The standard practice is to keep JavaScript lines under 80 characters. Some modern style guides allow up to 100 or 120 characters, but 80 remains the most widely adopted standard for better readability across different editors and devices. Breaking Long Lines When a statement exceeds the character limit, break it after a comma or operator, not in the middle of a variable name or string. ...

Read More

How to set the minimum height of an element with JavaScript?

Kumar Varma
Kumar Varma
Updated on 15-Mar-2026 760 Views

Use the minHeight property in JavaScript to set the minimum height of an element. This property ensures that an element maintains at least the specified height, even if its content is smaller. Syntax element.style.minHeight = "value"; The value can be specified in pixels (px), percentages (%), em units, or other CSS length units. Example: Setting Minimum Height #box { width: 300px; ...

Read More

What are the differences between group and layer in KineticJs with HTML?

Daniol Thomas
Daniol Thomas
Updated on 15-Mar-2026 598 Views

In KineticJS, groups and layers serve different organizational purposes when building HTML5 canvas applications. Understanding their differences is crucial for proper scene management. What are Groups? Groups are containers that hold multiple shape objects within a layer. They allow you to treat multiple shapes as a single unit for transformations and event handling. var stage = new Konva.Stage({ ...

Read More

Loop through a hash table using Javascript

Sai Subramanyam
Sai Subramanyam
Updated on 15-Mar-2026 2K+ Views

Hash tables (also called hash maps) store key-value pairs and provide efficient lookup. To iterate through all entries, we need to traverse each chain in the underlying storage container since hash tables typically use chaining to handle collisions. Creating a forEach Method The forEach method loops over all key-value pairs in the hash table and executes a callback function for each pair. We iterate through each chain in the container and process every key-value pair. forEach(callback) { // For each chain in the hash table this.container.forEach(elem => { ...

Read More

How to create a full screen overlay navigation menu with CSS and JavaScript?

Aman Kumar
Aman Kumar
Updated on 15-Mar-2026 2K+ Views

In this article, we are going to discuss how to create a full-screen overlay navigation menu with CSS and JavaScript. Overlay in web applications is nothing but transposing one HTML element over another. We can overlay images, pages, text, etc. A full-screen overlay navigation provides an elegant way to display navigation links that cover the entire viewport when activated. There are three ways to create a full-screen overlay navigation bar which are listed below: From the left side From the top side No animation There ...

Read More

Explain load events in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 849 Views

Load events in JavaScript are fired at different stages of the page lifecycle, from initial DOM construction to complete resource loading and page unloading. Understanding these events helps you execute code at the right time. Types of Load Events Event Description When It Fires DOMContentLoaded DOM tree is built but external resources like stylesheets and images are still loading HTML parsed completely load All resources (images, stylesheets, scripts) are fully loaded Page completely loaded beforeunload User is about to leave the page - can show confirmation dialog ...

Read More
Showing 18081–18090 of 61,297 articles
Advertisements