Nikhilesh Aleti

Nikhilesh Aleti

69 Articles Published

Articles by Nikhilesh Aleti

69 articles

DHTML JavaScript

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 15-Mar-2026 6K+ Views

DHTML stands for Dynamic Hypertext Markup Language. DHTML combines HTML, CSS, and JavaScript to create interactive and dynamic web pages. It allows for customization and changes to the content based on user inputs. Earlier, HTML was used to create static pages that only defined the structure of the content. CSS helped in enhancing the page's appearance. However, these technologies were limited in their ability to create interactive experiences. DHTML introduced JavaScript and the Document Object Model (DOM) to make web pages dynamic. With DHTML, the web page can be manipulated and updated in response to user actions, eliminating the ...

Read More

File Type Validation while Uploading it using JavaScript

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 15-Mar-2026 7K+ Views

File type validation is essential for web applications that handle file uploads. It ensures users only upload acceptable file formats, preventing security issues and maintaining data consistency. JavaScript provides built-in properties to check file types before submission. This validation process helps platforms like job portals, social media sites, and document management systems control what file types users can upload, such as restricting uploads to PDFs for resumes or images for profile pictures. How File Type Validation Works When a user selects a file, the browser exposes file information through the File API. The key property is file.type, ...

Read More

Create a Hoverable Side Navigation with HTML, CSS and JavaScript

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

A navigation bar is part of a webpage that contains links to appropriate sections/pages in a website, helping users browse fast and effortlessly. The navigation bar can be implemented in many ways, but the traditional approaches are horizontal and vertical bars. In this article, we'll design a vertical side navigation bar with hoverable buttons using HTML, CSS, and JavaScript. The navigation slides out when hovered and displays content when clicked. Project Structure Overview Our hoverable side navigation consists of three main components: HTML - Structure for navigation links and content sections ...

Read More

Removing all the empty indices from array in JavaScript

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 15-Mar-2026 2K+ Views

When working with JavaScript arrays, you may encounter arrays with empty indices (holes). These empty slots can cause issues in data processing. This article shows different methods to remove empty indices and create clean arrays. Understanding Empty Indices Empty indices in arrays are undefined slots that exist but have no value assigned: Empty Indices Example const array = [22, 45, , 56, 71, , 10]; console.log("Original array:", array); ...

Read More

Function to compute factorial of a number in JavaScript

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 15-Mar-2026 13K+ Views

In this article, we will explore different methods to calculate the factorial of a number in JavaScript. What is Factorial? The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example, the factorial of 4 is 4 × 3 × 2 × 1 = 24, represented as 4!. The value of 0! is defined as 1 by convention. Mathematical Formula The factorial of n is represented as n! and calculated using: n! = n × (n-1) × (n-2) × ... × 3 ...

Read More

Return an array of all the indices of minimum elements in the array in JavaScript

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 15-Mar-2026 1K+ Views

In JavaScript arrays, you might need to find all indices where the minimum value appears. This is useful when the smallest element occurs multiple times and you want to locate all positions. Problem Statement Given an array with duplicate minimum values, we need to return an array containing all indices of these minimum elements. Input: [10, 22, 30, 44, 10, 22, 30, 10, 10] Output: [0, 4, 7, 8] Here, 10 is the minimum value appearing at indices 0, 4, 7, and 8. Using Math.min() with Spread Operator Math.min() returns the smallest ...

Read More

Converting string to an array in JavaScript

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 15-Mar-2026 48K+ Views

In JavaScript, converting strings to arrays is a common task when you need to split text into characters or words for processing. JavaScript provides several built-in methods to accomplish this conversion efficiently. This article explores four different methods to convert strings to arrays, each suitable for different use cases and requirements. Using the split() Method The split() method is the most versatile approach for string-to-array conversion. It splits a string into an array of substrings based on a specified separator and returns a new array without modifying the original string. The split() method accepts two optional ...

Read More

Reorder an array in JavaScript

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 15-Mar-2026 10K+ Views

Reordering an array means changing the sequence of elements within the array. JavaScript provides several built-in methods to reorder arrays, each serving different purposes. Using sort() for Alphabetical Ordering The sort() method sorts array elements alphabetically in ascending order by default. It modifies the original array. const states = ["Telangana", "Uttar Pradesh", "Karnataka", "Kerala", "TamilNadu"]; document.getElementById("para1").innerHTML = "Original: " + states; states.sort(); ...

Read More

Decimal count of a Number in JavaScript

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 15-Mar-2026 14K+ Views

Given there is a number with digits after decimal point and the task is to find the count of digits after the decimal point. Input Output Scenario Let's look into the input output scenario, where there is a floating point number having some digits after decimal point. Input = 45.36346323 Output = 8 As we can see in the above snippet there are 8 digits in the floating point number after the decimal point. To achieve this task, we'll explore three different methods using isInteger(), toString(), and split() methods. Method 1: Using ...

Read More

Converting two arrays into a JSON object in JavaScript

Nikhilesh Aleti
Nikhilesh Aleti
Updated on 15-Mar-2026 5K+ Views

Given two arrays and the task is to convert those two arrays into a JSON object. Where the first array elements are keys of the object and the second array elements are values of the object. Input-Output Scenario Let's look into the scenario of how two arrays will be converted into a JSON object. Consider two arrays are having some elements. Now, we need to convert these two arrays into a JSON object. Array1 = [1, 2, 3, 4]; Array2 = ['A', 'B', 'C', 'D']; Output = {"1":"A", "2":"B", "3":"C", "4":"D"} //JSON object ...

Read More
Showing 1–10 of 69 articles
« Prev 1 2 3 4 5 7 Next »
Advertisements