Found 8895 Articles for Front End Technology

How to check for two timestamps for the same day in JavaScript?

Rushi Javiya
Updated on 10-Mar-2023 16:32:05

5K+ 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

How to check if an object is empty using JavaScript?

Rushi Javiya
Updated on 10-Mar-2023 16:30:55

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

Higher Order Functions and Currying in JavaScript

Rushi Javiya
Updated on 10-Mar-2023 16:28:56

189 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

Hide the cursor on a webpage using CSS and JavaScript

Rushi Javiya
Updated on 10-Mar-2023 16:27:22

4K+ 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

Handling Promise rejection with a catch while using await in JavaScript

Rushi Javiya
Updated on 10-Mar-2023 16:25:24

1K+ 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

Get the YouTube video ID from a URL using JavaScript

Rushi Javiya
Updated on 19-Jul-2023 10:39:52

983 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

Insert a character after every n characters in JavaScript

Pranay Arora
Updated on 09-Mar-2023 16:38:08

3K+ Views

Insertion of a specific character after every n characters in Javascript is an easy to understand concept and gives us a better understanding about Javascript's functions. Here n can be any whole number ranging from 1 to less than the length of the string. In this article we will deal with a variable inputString = "abcdefghijklmnopqrstuvwxyz, " and aim to append a "-" character after every 5 characters. There are several ways to accomplish this with JavaScript, which are as follows − Making use of the slice() method In JavaScript, the slice() function is used to extract a portion of ... Read More

Increment a given date in JavaScript

Pranay Arora
Updated on 09-Mar-2023 16:31:13

2K+ Views

In this article, we are going to discuss how to increment a given date using JavaScript. First, we will analyse and understand what is meant by this. Given a certain date x = “05-02-2023”, we want to add y = 7 days to this date and print the resulting date which is “12-02-2023”. As a human we can manually add 7 days to 5th February and get the resultant. But we need JavaScript to do this programmatically for us. There are few techniques to do so which we shall be discussing in this article. Using addDays() function The addDays function ... Read More

Implementation of LinkedList in Javascript

Pranay Arora
Updated on 10-Mar-2023 11:41:26

6K+ Views

A linked list is a data structure that consists of a sequence of elements, each of which contains a reference (or "link") to the next element in the sequence. The first element is called the head and the last element is called the tail. Linked lists have many advantages over other data structures. Now we shall look at how to implement Linked list using JavaScript. Defining the Node Class and the LinkedList class This is basically the prerequisite in order to implement a linked list in JavaScript. In this step, 2 classes namely one for the nodes and the other ... Read More

How to add sub heading using HTML?

Shabaz Alam
Updated on 10-Mar-2023 09:28:33

4K+ Views

A subheading is a text element used to organize and structure the content of a webpage in HTML. Subheadings are commonly used to break up large blocks of text and provide a clear hierarchy of information for users. Subheadings are mostly created using the "H2", "H3", "H4", "H5", or "H6" tags in HTML. These tags indicate the level of the heading, with H1 being the highest level heading and H6 being the lowest level subheading. Adding sub heading using HTML HTML is a markup language used to structure and format content on the web page. One of the important aspect ... Read More

Advertisements