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
Web Development Articles
Page 116 of 801
JavaScript Program to Generate a matrix having sum of secondary diagonal equal to a perfect square
We will write a JavaScript program that generates a matrix with the sum of the secondary diagonal being a perfect square. Our program will use nested loops to traverse the matrix and calculate the sum of the secondary diagonal elements. We will then use the Math.sqrt() method to find the square root of the sum and check if it is a whole number. If it is, we will consider the sum to be a perfect square. Understanding Secondary Diagonal The secondary diagonal (also called anti-diagonal) consists of elements from the top-right to bottom-left corner. For a 3×3 matrix, ...
Read MoreHow to convert speech to text using JavaScript?
Overview To convert spoken words to text, we use the Web Speech API's SpeechRecognition component. The SpeechRecognition interface recognizes spoken audio and converts it to text. The spoken words are processed and displayed as text in HTML elements on the browser screen. Syntax The basic syntax for creating a speech recognition instance: let recognition = new webkitSpeechRecognition(); // or let recognition = new SpeechRecognition(); Note: webkitSpeechRecognition() is used for Chrome and Safari browsers, while SpeechRecognition() is the standard implementation for other browsers. Browser Compatibility Check Before implementing speech recognition, it's important ...
Read MoreImage Classification using JavaScript
Image classification is a machine learning technique that identifies and categorizes objects within digital images. When you upload a photo to Google Photos, for instance, it uses image classification to suggest locations, identify people, or tag objects automatically. We can use OpenCV to detect detailed information from images and make predictions. However, training models from scratch requires extensive datasets and computational resources. This tutorial demonstrates using ml5.js, a JavaScript library with pre-trained models that leverages browser GPU for efficient image classification. What is ml5.js? The ml5.js library provides various pre-trained machine learning models, making AI accessible to ...
Read MoreJavaScript Program for Find the smallest missing number
We are given a sorted array of distinct non-negative integers, here we have to find the smallest missing number. Hence in this tutorial, we will explore different methods to solve this problem and discuss their time complexities with various examples. Understanding the Problem The problem statement is quite simple. Given a sorted array of distinct non-negative integers, we need to find the smallest missing number in it. Let's take an example to understand the problem. Example Let's say that we have an array [1, 2, 4, 5, 6]. Here, We can see that there is a ...
Read MoreHow to create a FAQ page using JavaScript
A Frequently Asked Questions (FAQ) page is essential for websites, helping users find answers to common questions quickly. This tutorial shows how to create an interactive FAQ page using JavaScript with an accordion-style interface. Overview FAQ pages reduce support requests by providing instant answers to common questions. The most effective approach is using an accordion component where questions can be clicked to reveal or hide answers. Approach We'll create an accordion-style FAQ using HTML structure, CSS styling, and JavaScript functionality. Each FAQ item will toggle between expanded and collapsed states when clicked. Implementation Steps ...
Read MoreHow to create form dynamically with the JavaScript
Creating HTML forms dynamically with JavaScript allows you to build interactive web pages that generate content based on user interactions. This approach uses DOM methods like createElement(), setAttribute(), and appendChild() to construct form elements programmatically. Key DOM Methods The essential methods for dynamic form creation: createElement() Creates any HTML element dynamically: document.createElement(tagName); setAttribute() Adds attributes to elements using key-value pairs: element.setAttribute(attributeName, value); appendChild() Inserts created elements into the DOM: parentElement.appendChild(childElement); Basic Dynamic Form Example Here's a simple example that creates a contact form when a button is ...
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 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 MoreJavaScript Program for Rotate Doubly linked list by N nodes
A doubly linked list is a linear data structure where each node stores references to both the next and previous nodes. In this tutorial, we'll learn how to rotate a doubly linked list by N nodes in both clockwise and counter-clockwise directions. Rotation means moving elements from one end of the list to the other. For N rotations, we take N nodes from one end and move them to the opposite end while maintaining the doubly linked structure. Understanding Rotation Direction Counter-clockwise rotation: Move the first N nodes to the end of the list. Clockwise rotation: Move ...
Read MoreJavaScript Program to Check if it is possible to make array increasing or decreasing by rotating the array
Rotation of the array means to assume the array as a circular array and rotate the elements of the array to either their left or right direction by one index at each rotation and the element at one end may take the value present at another end. An Increasing array means that each element will be greater than or equal to its previous element and decreasing array means each element will be less than or equal to the previous element. In this problem, we are given an array and we can rotate the array in either the left or ...
Read More