In this tutorial, we will learn about the different methods or ways of finding the largest number contained inside a JavaScript array. An array is a collection of different values. We will define an array of numbers in which we will search for the largest number. There are three ways of finding the largest number in a JavaScript array that is listed below − Traversing the Whole Array Using the reduce() Method Using the Math.max() and apply() methods Traversing the Whole Array This is the easiest or the most naive approach to find the largest number in the ... Read More
In this tutorial, we will learn how we can find the id of the form element to which a button belongs using JavaScript. In HTML, we can use button tag in two ways with form tag, where it can be used to perform some activity in the form when it is clicked, as listed below − Button is inside the FORM tag Button is outside the FORM tag No matter where the button is located, whether it is inside or outside, we can find the ID of the form tag to which the button belongs using JavaScript. Let ... Read More
In this tutorial, we will learn how we can get the coordinates of the mouse cursor relative to the screen with JavaScript. We will find the position of the cursor vertically (Y-axis) and Horizontally (X-axis) relative to the screen. JavaScript allows us to use two different properties to get the coordinates of the mouse cursor relative to the screen when the mouse button is pressed anywhere on the screen − Using the event.screenX Property Using the event.screenY Property Let us discuss both of them one by one with code examples. Using the event.screenX Property The event.screenX property is ... Read More
In this tutorial, we will learn how we can find out which JavaScript event is fired or triggered. We can add events to HTML elements to perform some actions on the webpage like changing text, form submission, etc. There are two ways of finding which JavaScript event is fired − Using Developer Tools Using Inspect Element Let us discuss both of them one by one with coding examples. Using Developer Tools We can find out which JavaScript event is fired by using developer tools in the browser. To open Developer tools, you need to press ctrl + shift ... Read More
In this tutorial, let’s find out how to extend an existing JavaScript array with another array. Before explaining the steps, we need to be aware that there is a requirement for several arrays at various times, and learning the right method can save our coding time. You will find more than four methods to extend an array with another. So, most likely, find an easy-to-remember method in the tutorial. Using Array push() Method and Spread Syntax The push() method is extremely useful in adding items to an existing JavaScript array. Moreover, you can pass a variety of different arguments based ... Read More
In this tutorial, we will learn how we can find a character between the brackets in JavaScript RegExp with examples. Syntax Following is the syntax that you have to follow for finding the character between the brackets of JavaScript RegExp − [……] In the above syntax, you can put the character or the combination of characters that you are searching in place of dots while the square brackets are the basic syntax to indicate the use of JavaScript RegExp. Below is the list of different syntaxes that you can use to check for the presence of different characters in ... Read More
RegExp or RegEx in JavaScript is the short form of Regular Expressions. Regular Expressions are used to check validity of a particular combination of characters, digits, or any other symbol entered by the user. Regular expressions are mainly used for checking valid emails, and passwords that authenticate the correct user to log in. In this tutorial, we will learn how we can find a character that is not present between the brackets of JavaScript RegExp. Syntax Following is the syntax that is used to find the character, not between the brackets of JavaScript RegExp − [^……] In above syntax, ... Read More
In today’s time, almost everyone knows Google Chrome and how to use it for their comfort. But in the case of a developer, it is a must to have advanced knowledge of using Chrome because Chrome can help a developer tackle problems in many ways such as solving the problems or debugging the code with ease, inspecting the code, and finding JavaScript functions defined in the code. In this tutorial, we will learn how we can find a JavaScript function in Google Chrome that is defined in the JavaScript code. Here are three ways of finding the JavaScript function in ... Read More
Working professionals and recent college grads often choose an MBA. Why is that? A vast range of specialties, prosperous job options, and the luxurious lifestyle we all desire are all available with an MBA. People from various walks of life enroll in this program to advance their careers. But how can you choose the MBA concentration that's best for you? Before selecting a specialism, you should know your professional aspirations and the MBA course outline of all the available MBA programs that could benefit you. The MBA curriculum is created to provide students with a comprehensive understanding of the ... Read More
In this tutorial, we will learn how to display an HTML element using JavaScript. HTML elements are the components that make up an HTML format file. These components are in charge of constructing web pages and defining their content. In HTML, an element typically consists of a start tag (tag name), a closing tag (tag name), and any text that is added in between. A collection of end tags, start tags, content, and attributes is what constitutes an element technically. Some HTML elements are − Starting Tag Content Ending Tag This is a paragraph. ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP