Articles on Trending Technologies

Technical articles with clear explanations and examples

Inserting a node in a Javascript AVL Tree

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

We can learn how to insert a node in an AVL Tree. Insertions in AVL trees follow the same process as BST, but we need to perform one extra step called balance tree during insert whenever we move down the tree. This requires calculating the balance factor and applying appropriate rotation methods based on the tree configuration. The balance factor determines which type of rotation is needed to maintain the AVL property. Understanding AVL Tree Balance An AVL tree maintains balance by ensuring that for every node, the heights of its left and right subtrees differ by ...

Read More

What is the relation between 'null' and '0' in JavaScript?

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

In JavaScript, the relationship between null and 0 creates a seemingly contradictory behavior that confuses many developers. While null is neither greater than nor equal to 0 in equality checks, it evaluates as greater than or equal to 0 in comparison operations. Understanding null and 0 null is a primitive value representing an intentional absence of value, while 0 is a number. The confusing behavior occurs due to JavaScript's type coercion rules, which differ between equality (==) and comparison (>, =,

Read More

Replace a child node with a new node in JavaScript?

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

In this article we are going to learn how to replace a child node with a new node in JavaScript with suitable examples. To replace a child node with a new node, JavaScript provides two built-in DOM methods: replaceChild() and replaceWith(). Both methods allow you to swap an existing node with a new one in the DOM tree. The methods replaceChild() and replaceWith() are supported by all modern browsers and are features of the DOM specification. replaceChild() Method The replaceChild() method is called on the parent element to replace one of its child nodes. Syntax ...

Read More

How to create a clickable dropdown menu with CSS and JavaScript?

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

To create a clickable dropdown menu with CSS and JavaScript, you can build an interactive navigation component that saves space while providing easy access to multiple options. This approach helps keep your webpage clean and organized without overwhelming users with too many visible elements. In this tutorial, we'll create a dropdown menu with a toggle button and multiple navigation links, demonstrating the complete process from HTML structure to JavaScript interactivity. Steps to Create a Clickable Dropdown Menu We will follow these three essential steps to build our dropdown menu: Structuring the ...

Read More

How to make a fullscreen window with JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 629 Views

The Fullscreen API allows you to display HTML elements in fullscreen mode. This is commonly used for videos, images, or interactive content that benefits from maximum screen real estate. Syntax element.requestFullscreen() // Standard element.webkitRequestFullscreen() // WebKit (Safari, Chrome) element.mozRequestFullScreen() // Firefox element.msRequestFullscreen() // IE/Edge Example: Video Fullscreen body { ...

Read More

How do JavaScript primitive/object types passed in functions?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 285 Views

In JavaScript, understanding how data types are passed to functions is crucial. Primitive types are passed by value, while objects are passed by reference. This affects how modifications inside functions impact the original data. Pass by Value (Primitives) Primitive types (string, number, boolean, null, undefined, symbol, bigint) are passed by value. A copy is made, so changes inside the function don't affect the original variable. Pass by Value Example function modifyPrimitive(value) { value = value + 10; document.getElementById('output').innerHTML += ...

Read More

Is it possible to select text boxes with JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 793 Views

Yes, it's possible to select text boxes with JavaScript using the select() method. This method highlights all text within an input field, making it ready for user interaction or replacement. The select() Method The select() method programmatically selects all text content in an input field. It's commonly used to improve user experience by pre-selecting text for easy editing or copying. Basic Syntax element.select(); Example: Selecting Text on Button Click Select Text Box Example ...

Read More

Sorting Array with JavaScript reduce function - JavaScript

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

We are required to write a JavaScript function that takes in an array of numbers. The function should sort the array without using the Array.prototype.sort() method. We are required to use the Array.prototype.reduce() method to sort the array. Let's say the following is our array: const arr = [4, 56, 5, 3, 34, 37, 89, 57, 98]; Understanding the Approach The reduce() method can be used to build a sorted array by iterating through each element and placing it in the correct position within an accumulator array. We'll use insertion sort logic within the ...

Read More

How to convert a date object to string with format hh:mm:ss in JavaScript?

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

We will learn to convert the date object to a string with the format hh:mm:ss in JavaScript. Working with dates and times is common in web development, and formatting them according to specific requirements is an essential skill. The default date object returns a complete date string, which might contain more information than needed. Here, we will explore different approaches to extract and format just the time portion in hh:mm:ss format. Using toTimeString() Method The toTimeString() method returns the time portion of a Date object as a human-readable string. We can then extract the first 8 characters ...

Read More

How to differentiate between Manual and Automated Animation in JavaScript?

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

Generally, animation in JavaScript is done to get different effects and make the object move around the page. You can move and animate any type of HTML element using manual or automated animations in JavaScript. In this tutorial, we will learn how to differentiate between manual and automated animation in JavaScript. Manual Animation Manual animation requires user interaction to trigger movement or changes. The animation process is not automated and depends on events like button clicks or mouse actions. The following implementation demonstrates a simple manual animation using DOM object properties and JavaScript functions: ...

Read More
Showing 18271–18280 of 61,297 articles
Advertisements