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 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 MoreHow To Change Text Inside All HTML Tags Using JavaScript
In this article, we are going to perform the task of changing text inside all HTML tags using JavaScript. Let's dive into the article to learn more about changing text within all HTML, but first, let's define HTML tags. What are HTML Tags An HTML tag is a segment of markup language used to denote the start and end of an HTML element in an HTML document. HTML tags, which are a component of an HTML element, assist web browsers in turning HTML documents into web pages. For getting better understanding on changing text inside all HTML ...
Read MoreJavascript Program to Minimize Characters to be Changed to make the Left and Right Rotation of a String Same
In this problem, we need to find the minimum number of character changes required to make a string's left and right rotations identical. This involves understanding how rotations work and finding patterns in character positioning. Understanding Rotations The left rotation moves characters left by one position, while right rotation moves them right. For rotations to be identical, specific character patterns must exist: Odd length strings: All characters must be the same Even length strings: Characters at even positions must be identical, and characters at odd positions must be identical Problem Analysis Given a ...
Read MoreHow to Convert JSON to ArrayBuffer in JavaScript?
In JavaScript, an ArrayBuffer is a kind of binary structure that enables the manipulation of raw binary data. While JSON represents data as strings, it is sometimes useful to convert JSON into an ArrayBuffer when working with binary APIs or when you need to optimize data transmission. In this article, we will explore two common methods for converting JSON objects into ArrayBuffers in JavaScript. Approaches to Convert JSON to ArrayBuffer Using TextEncoder: Suitable for UTF-8 encoding (recommended). Manual Conversion with DataView: Useful for handling specific binary encoding formats or custom ...
Read MoreJavaScript Program to Find Closest Number in Array
To find closest number in array using JavaScript, we will be understanding and discussing three different approaches. We will also compare time and space complexities of all the approaches used. In this article we are having an array and a target value, our task is to find closest number to target value in array using JavaScript. User must know about JavaScript arrays, searching algorithms such as linear and binary search, sorting, loops, and conditional statements. Approaches to Find Closest Number in Array Here is a list of approaches to find closest number in array in JavaScript which ...
Read MoreJavaScript Program to Find Difference Between Sums of Two Diagonals
To find difference between sums of two diagonals, we will be discussing two different approaches. We will calculate the sum of the elements present in the left and right diagonal, then we will subtract both sum values to get the difference. In this article we are having a square matrix, our task is to write a JavaScript program to find difference between sums of two diagonals. ...
Read MoreBuilding Voice-controlled Applications with JavaScript and Speech Recognition APIs
Voice-controlled applications have become increasingly popular in recent years, allowing users to interact with technology through speech rather than traditional input methods. JavaScript, being one of the most widely used programming languages for web development, provides a powerful platform for building such applications. In this article, we will explore how to utilise JavaScript and Speech Recognition APIs to create voice-controlled applications. We will dive into the process of setting up speech recognition, capturing and processing user speech, and implementing voice commands in your applications. Setting Up Speech Recognition Before we start building our voice-controlled application, we need to ...
Read MoreJavaScript Program to Find element at given index after a number of rotations
When working with arrays in JavaScript, we often need to find elements after rotating the array. A rotation shifts all elements in a specific direction. This program demonstrates how to efficiently find an element at a given index after performing a number of right rotations without actually rotating the array. Understanding Array Rotations A right rotation shifts all elements one position to the right, with the last element moving to the first position. For example, rotating [1, 2, 3, 4, 5] right by 2 positions gives [4, 5, 1, 2, 3]. ...
Read MoreHow to convert Title to URL Slug using JavaScript?
Overview The conversion of a title to URL Slug is also known as "Slugify" a title. A URL Slug refers to a descriptive, readable identifier attached to a page's URL that describes the content. Converting titles to URL-friendly slugs involves using JavaScript string methods like toLowerCase(), replace(), and trim(). Algorithm Step 1 − Create HTML input elements with IDs "title" and "urlSlug" for input and output, plus a button with onclick event. Step 2 − Create a convert() function to handle the transformation. Step 3 − Get the title value using document.getElementById("title").value. Step 4 − Convert to lowercase ...
Read MoreJavaScript program to find if there is a subarray with 0 sum
A subarray with a sum of 0 is a sequence of contiguous elements within an array where the sum of all elements in that sequence equals zero. Identifying such subarrays is a common problem in data analysis and coding challenges. The prefix sum technique efficiently solves this problem. In this article we will find if there is a subarray with 0 sum using JavaScript. The key insight is to use prefix sums (cumulative sums) along with a data structure to track previously seen sums: Continuously calculate the prefix sum while traversing the array ...
Read More