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
Javascript Articles
Page 4 of 534
Replace elements by its rank in the array in JavaScript
In this problem, we are given an array, and we have to replace each element with its rank. The rank of an element is the position of the element when element of the array is arranged in sorted order. In this article, we are going to learn about various approaches to replacing elements with their rank in an array using JavaScript. Below are the examples to understand the problem clearly - Example 1: Input: arr = [40, 10, 20, 30] Output: [4, 1, 2, 3] Explanation: The sorted, unique array is: [10, 20, ...
Read MoreWhat are the differences between “untyped” & “dynamically typed” programming languages?
When learning different programming languages, you may come across terms like untyped and dynamically typed. While they may sound similar but they have different concepts in how programming languages manage data types. In this article, we will see these concepts in simple terms with simple examples. Untyped Language Untyped programming languages do not have a strict definition of data types. This allows you to use values without providing the data type. The interpreter or execution environment will handle everything anyway it considers a match. Example Let us look at an example that uses an untyped language - # ...
Read MoreJavaScript program to remove vowels from a string
A string is a sequence of characters that can include alphabets, numbers, and symbols together or separately. In this article, we are going to learn how we can remove vowels from a given string in JavaScript using different approaches. There are a total of five vowels in the English alphabet. The five vowels in the English alphabet are: a, e, i, o, u, and they can be both uppercase or lowercase. Vowels are some specific alphabetic characters that represent specific speech sounds.There are a total of 5 vowels in 26 letters of the alphabet from A to Z, both ...
Read MoreJavaScript Program for Equilibrium Index of an Array
To write a JavaScript program for equilibrium index of an array, we are going to discuss three different approaches with detailed explanation and example codes. The equilibrium index of an array is the position where the sum of the elements to its left and right equals one another. In this article we are having an array of integers, our task is to to write a JavaScript program for equilibrium index of an array. Example Input: arr = [-7, 1, 5, 2, -4, 3, 0] Output: Equilibrium index: 3 At index 3, left sum = -7 + ...
Read MoreArrays vs Set in JavaScript.
In this article, we will learn about the difference between an array and a set in JavaScript. Arrays are used to store ordered collections of elements, whereas in Sets, we can store only unique values. What is an Array? An Array is an ordered, indexed collection of values in JavaScript. It allows duplicate values and provides various built-in methods to manipulate elements. Syntax let numbers= [1, 2, 3, 4, 5]; What is a Set? A Set is an unordered collection of unique values in JavaScript. Unlike arrays, a Set does not allow duplicate values. Syntax let numbers= new Set([1, 2, ...
Read MoreWhat are the advantages of JavaScript?
JavaScript is a dynamic computer programming language. It is lightweight and most commonly used as a part of the web pages, whose implementation allows a client-side script to interact with a user and to make dynamic pages. It is an interpreted programming language with object-oriented capabilities. Advantages of JavaScript The advantages of using JavaScript are the following − Less server interaction − You can validate user input before sending the page off to the server. This saves server traffic, which means less load on your server. Immediate feedback to the ...
Read MoreHow to enable JavaScript in Internet Explorer (IE)?
To enable JavaScript in Internet Explorer (IE), follow the below-given steps: Opening Internet Options Click the gear icon on the right-hand side: Navigating to Security Settings Now, a dialog box will open. Go to the Security tab and click Custom level. After reaching the Security Settings, go to Scripting, then Active Scripting. Enabling Active Scripting Click Enable to enable JavaScript and press Ok. Now, JavaScript will enable after clicking Ok. Conclusion Once you enable Active Scripting and save the changes, JavaScript will be activated in Internet Explorer. Restarting the browser may be required for the settings to take effect.
Read MoreJavaScript program to find Number of Squares in an N*N grid
A grid is a 2-dimensional arrangement of squares divided into rows and columns. From a given N*N square grid we have to calculate the total number of squares possible. There are multiple ways to find the number of squares in a given grid. In this article, we are going to learn about various approaches for calculating the number of squares in a given grid of size N*N. Direct Formula for Finding the Number of Squares in an N*N Grid The direct formula for finding the total number of squares in an N * N grid is Total Number of ...
Read MoreShould I include type=\'text/javascript\' in my SCRIPT tags?
The type attribute in JavaScript is optional since the introduction of HTML5 brought some new improvements. JavaScript became the default language for HTML5 and modern browsers. So, now adding text/javascript isn’t required in tag. This attribute is what is now recommended to indicate the scripting language in use and its value should be set to "text/javascript". Example Here you can see how it is used: Output
Read MoreC++ program to find the sum of elements between two given indices in array
Finding the sum of elements between two given indices in an array is a common operation in programming. In C++, there are multiple ways to calculate the sum of elements between two given indices in C++. In this article, we are going to discuss various approaches to calculating the sum of elements between two indices in an array using C++. How to Find the Sum of Elements Between Two Indices? In this problem, we are given an array and two indices, L and R, and we have to find the sum of elements from index L and R (both L ...
Read More