Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
How to Validate Mobile Number Length in ReactJS?
Nowadays, validation of mobile number input is a required feature for any application, and it requires validation of the length of the mobile number. Many apps use the mobile number for authentication purposes, sending OTP to users' mobile numbers for successful authentication. If the user enters the wrong mobile number, the app can face issues with sending OTP. So, before the user submits the mobile number for registration or authenticates the app, our app should validate the length of the mobile number. This tutorial will teach us various approaches to validating a mobile number using ReactJs. ...
Read MoreHow to Check a String Starts/Ends with a Specific String in jQuery?
JavaScript provides several built-in methods to check if a string starts or ends with specific characters. While jQuery is excellent for DOM manipulation, these string operations are handled by native JavaScript methods that work efficiently without any additional library. In this article, we'll explore various approaches to verify if a string begins or ends with another string using practical examples. Using startsWith() Method The startsWith() method is the most direct way to check if a string begins with specific characters. It's case-sensitive and returns a boolean value. Syntax str.startsWith(searchString, position) Parameters ...
Read MoreCreate a Hoverable Side Navigation with HTML, CSS and JavaScript
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 MoreJavaScript Program for Maximum and Minimum in a Square Matrix
To get maximum and minimum in a Square Matrix in JavaScript, we will be discussing two different approaches, their complexities, and example codes. The first approach uses nested loops while the second approach uses Math functions. In this article we are having a 2D square matrix, our task is to write a JavaScript program for maximum and minimum in a square matrix. Problem Statement Input: Matrix: [ [1, 3, 7], [5, 2, 9], [2, 5, 1] ] Output: Maximum ...
Read MoreHow to Design Digital Clock using JavaScript?
Dealing with time is one of the most common concepts of web developers. Whether to schedule time for the subscription period or schedule email sending requires developers to deal with the time. In this article, we will learn how to design a digital clock using JavaScript. Get The Time On Clicking The Button We can achieve the same operation using multiple logic and codes. First, in this section, we shall learn how to design a digital clock that shows the time when the user clicks on the button. Follow the steps to achieve the step − ...
Read MoreHow Blazor Framework is Better Than JavaScript Frameworks?
Web development is a rapidly evolving field, and Microsoft's Blazor framework is one of the latest entrants in the arena. Blazor is a client-side web framework that allows developers to build web applications using C# and .NET instead of JavaScript. While JavaScript frameworks like Angular, React, and Vue.js have been popular choices for web development for many years, Blazor offers some unique advantages that make it an attractive alternative. In this article, we will discuss how Blazor framework may be considered better than JavaScript frameworks, including language familiarity, rendering, code sharing, tooling, security, and more. We'll also explore the ...
Read MoreHow to find position of HTML elements in JavaScript?
Overview JavaScript provides several methods to find the position of HTML elements. The two main approaches are using offset properties (offsetLeft and offsetTop) and the getBoundingClientRect() method. The offset properties return the position relative to the nearest positioned ancestor, while getBoundingClientRect() returns the position relative to the viewport. Syntax There are two primary ways to get element position: Using offset Properties element.offsetLeft // Horizontal position element.offsetTop // Vertical position Using getBoundingClientRect() var rect = element.getBoundingClientRect(); // Returns: { top, left, right, bottom, width, height } ...
Read MoreHow to create an Asynchronous function in JavaScript?
A JavaScript asynchronous function is a function that runs independently of the main flow of the program. This allows the program to continue executing other code while the async function is running. The async keyword is used to declare an async function, and await is used to pause the execution until a specific asynchronous task is completed. Methods to Create Asynchronous Functions Using async/await Keywords The simplest way to create an asynchronous function is to use the async keyword before the function declaration. Syntax async function fetchData() { const response = ...
Read MoreHow to find width of a div using vanilla JavaScript?
Overview JavaScript provides two built-in properties to find the width of a div element: offsetWidth and clientWidth. These properties return the width in pixels but calculate it differently based on what measurements they include. Syntax element.offsetWidth element.clientWidth offsetWidth − Returns the total width including content, padding, border, and scrollbar (if present) clientWidth − Returns the width including content and padding, but excludes border and scrollbar Understanding the Difference The key difference between these methods is what measurements they include: Property Includes Content Includes Padding Includes Border Includes Scrollbar ...
Read MoreA Game Using Javascript – Fire the bullets
This tutorial demonstrates how to create an action-packed commando game using JavaScript and Code.org's Game Lab. The player controls a commando navigating through a maze-like area filled with enemy tanks, collecting keys, and escaping through a door. Game Story and Rules The player controls a commando using arrow keys (UP, DOWN, LEFT, RIGHT) to navigate through a walled area. The objective is to find the correct key and reach the exit door while avoiding enemy fire. Enemy tanks automatically shoot bullets when the commando enters their range. The commando has a protective shield activated by pressing the 's' ...
Read More