
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6710 Articles for Javascript

212 Views
We will implement a code to find the longest subsequence of a given number that has the same left and right rotation in the JavaScript programming language. The left and right rotation of a given number means, for left rotation we have to move the left-most digit of the number to the end position or the rightmost position. Similarly, for the right rotation, we have to move the right-most digit of the number to the first position or the leftmost position. We will see the complete code with the implementation. Introduction to Problem In this problem, we are given a ... Read More

1K+ Views
To implement left rotation and right rotation of a string, we can use various approaches to implement this problem. Left rotation of a string means anti-clockwise movement of the given number of characters and right rotation of the string means clockwise movement of the given number of characters. In this article we are having a string and a value of k by which we will rotate the string. Our task is to write a JavaScript program for left rotation and right rotation of a string. Example Input: String str = "apple"; k = 3 Output: Left Rotation: ... Read More

688 Views
In this program, we are given an array of integers or elements and we have to return the element which presents the least numbers of the time in the array, and if there is more than one least frequent number present we can return any one of them which we are going to see in the article below. Introduction to Problem In the given problem we have to find the least frequent element in an array. Here we have given an array with duplicate numbers and here we have to count the occurrence of each element and among all of ... Read More

416 Views
In this article, we are going to explore a Javascript program that works with a sorted array containing duplicate elements. The task is to traverse the array using a loop and identify both the index of the last duplicate element and the duplicate number. Introduction to Problem In the given problem we have to find the last duplicate element in a sorted array. Duplicate means the number is present more than one time. Example − Input arr[] = {1, 2, 2, 3, 5, 5, 6, 7} Output Last index: 5 Last duplicate value: 5 From the above given sorted array, ... Read More

1K+ Views
Overview The conversion of a title to URL Slug is also known as to “Slugify” a title. An URL Slug refers to a title which is descriptive by itself and is easy to read. It is attached to the URL of a page which tells about the current page as the slug is self-descriptive. So to convert a title to slug using JavaScript can be achieved using certain JavaScript functions such as toLowerCase(), replace(), trim(). Algorithm Step 1 − Create a HTML page with two input tags and add the id attribute in it as “title” and “urlSlug” respectively, ... Read More

18K+ Views
Overview To convert the spoken words to the text we generally use the Web Speech API’s component that is “SpeechRecognition”. The SpeechRecognition component recognizes the spoken words in the form of audio and converts them to the text. The spoken words are stored in it in an array which are then displayed inside the HTML element on the browser screen. Syntax The basic syntax used in is − let recognization = new webkitSpeechRecognition(); We can also use SpeechRecognition() instead of webkitSpeechRecognition() as webkitSpeechRecognition() is used in chrome and apple safari browser for speech recognition. Algorithm Step 1 ... Read More

942 Views
To insert a node in a linked list using JavaScript, how can we do it? A linked list consists of nodes, each storing data and a reference to the next node. We can insert a new node at various positions: the beginning, a specific position, or the end of the list.. In this article, we'll guide you through how to insert a new node into a linked list in JavaScript, including adding a node at the start, a specific position, or the end. Example Input 1: list = 1 -> 2 -> 3 -> 4 -> 5 -> null; ... Read More

257 Views
To get frequencies of even and odd numbers in a matrix, we will be discussing three different approaches. We will discuss each approach with code examples and solution of the algorithm being used. In this article we are having a 2D matrix, our task is to write a JavaScript program for frequencies of even and odd numbers in a matrix. Users must be familiar with conditional statement, nested loops and javascript operators. Example Input: Matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; Even numbers: {2, 4, 6, 8} Odd numbers: {1, 3, 5, 7, ... Read More

190 Views
In this program, we will be given a linked list that may consist of a loop and we have to find if the loop exists then what will be the size of the loop. Let’s a very famous approach to finding the length of a loop with the help of a code and discuss its time and space complexity. Introduction to Problem In this problem, as we have seen above we are given a linked list that may or may not contain a loop in it and we have to find the length of the loop if it exits ... Read More

460 Views
To find the length of a linked list in JavaScript, we need to count how many nodes are present. A linked list is made up of nodes, where each node contains data and a reference to the next node. The length is determined by starting at the head and counting each node until the end of the list. If the list is empty, the length should be 0. Our task is to write a JavaScript program that calculates the length of a linked list . In other words, we need to find out how many nodes are in the ... Read More