
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

4K+ Views
In this tutorial, we will learn to find the difference between two dates and check if the difference is less than one hour. Sometimes, developers must play with the Date object and perform some operation every hour. So, this can be one approach that checks if a particular operation is performed before an hour, perform it again; otherwise, wait to complete the hour. Here, we will learn different approaches to check if the date is less than 1 hour ago using JavaScript. Use the getTime() method The getTime() method returns the total milliseconds for the date from 1st ... Read More

8K+ Views
Sometimes, developers require to manage the HTML from JavaScript. For example, developers need to append some HTML nodes to a particular HTML element by accessing them in JavaScript. So, before we append an HTML string to any HTML element using JavaScript, we need to evaluate the string we are appending and check if it is valid. If we append the HTML string, which has an opening tab but doesn’t contain the closing tag, it can generate errors in the webpage. So, we will learn different approaches to validate the HTML string using JavaScript. Use the regular expression ... Read More

616 Views
In JavaScript, when we divide any number by zero, we can get the infinity value. Also, developers can make a mistake in writing the mathematical expression which evaluates to Infinity. So, before we perform any operation with the returned value from the mathematical expression, we need to check if the number value is finite. Here, we will learn three approaches to check if a number evaluates to Infinity using JavaScript. Comparing the number value with the Number.POSITIVE_INFINITY and Number.NEGATIVE_INFINITY In JavaScript, a Number is an object containing different properties and methods related to numbers. The POSITIVE_INFINITY and ... Read More

24K+ Views
Users can open multiple tabs in the browser, and they can also check if any particular tab is currently active or not in the browser. For example, if you have given a proctored test, you can observe that it detects that tab is changed whenever you change the tab in the browser So, there can be many applications and uses for checking whether the browser tab is active. This tutorial will teach us two methods to check whether the browser’s tab is active. Using the onblur() and onfocus() methods of the window object The window object contains the different ... Read More

6K+ Views
It never happens that you use JavaScript in developing your application, and you don’t use the Date object. The Date object is very important in JavaScript, which allows us to create and manipulate the date according to the developer’s requirements. In this tutorial, we will learn to check whether two timestamps are for the same or different days. In real-time development, it is very useful. For example, we wanted users to perform some everyday tasks. So, we need to check whether users have performed the task for today, and we can check that by comparing the last date of ... Read More

3K+ Views
In JavaScript, the object is the most important data type, and we require its most of the time while developing the application with the JavaScript framework. Sometimes, we need to check whether an object is empty and perform the operation based on the object value. For example, you are fetching the data from the database; if it isn’t found, you can get an empty object. When you perform some operation or execute some method on an empty object, it raises an error in the program. So, it’s better first to check whether the object is empty. We will ... Read More

286 Views
In any programming language, functions are a very useful feature. Developers might be able to find any programming language which doesn’t contain the function. Also, when we start learning any programming language, we definitely learn the function, a block of code that provides the code reusability. In this tutorial, we will learn about higher-order functions and currying. Higher Order Functions Before we start currying in JavaScript, let’s first learn about the higher-order function. The simple definition of the higher order function is A function that takes another function as an argument or returns a function. Have you ever ... Read More

6K+ Views
In this tutorial, we will learn to hide the cursor in a webpage using CSS and JavaScript. Sometimes, we need to create our style cursor, and then we need to hide the cursor. Maybe it also needed to hide the cursor for a particular HTML element. There are two ways to hide the cursor on the Webpage. One uses CSS, and another uses JavaScript. We will learn both approaches one by one in this tutorial. Use the CSS to hide the cursor on the Webpage The CSS allows us to change the style of the cursor. We can ... Read More

2K+ Views
In JavaScript, users can perform particular actions using the Promise. For example, we can create the promise to fetch data from the database using the API. If the promise gets the data from the database successfully, that means the promise is a success, or the promise gets an error, which means the promise is rejected. Let’s look at the syntax to create the promise first. Syntax Users can follow the syntax below to create a promise in JavaScript. let testPromise = new Promise((res, rej) => { // perform some operation }); ... Read More

2K+ Views
Every YouTube video has a unique URL through which we can access it in the browser. Every YouTube video contains a unique video id, which makes the URL unique. Sometimes, developers need to extract the video id from the YouTube URL. We need to play with the YouTube URL string to extract the video id from the URL, which we will do in this tutorial. We will learn different approaches to getting the video id from a full URL. Use the split() method JavaScript contains the built-in split() method, which allows users to split the string into multiple ... Read More