Found 10710 Articles for Web Development

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

986 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

How to change the color of an image to black and white using CSS?

Shabaz Alam
Updated on 03-Jul-2024 17:33:53

13K+ Views

To change the color of an image to black and white using CSS, is a simple process that can be done using various approaches. In this article, we will learn and understand two different methods for changing an image to black and white using CSS. We are having an image in this article, our task is to change the color of image to black and white using CSS Approaches to Change Color of Image to Black and white Here is a list of approaches to change the color of an image to black and white using CSS with step wise ... Read More

How to change the cases of text in paragraph using CSS?

Shabaz Alam
Updated on 09-Mar-2023 17:50:04

571 Views

CSS (Cascading Style Sheets) is a powerful tool for controlling the layout and appearance of text on a website. In this article we will learn how to change the cases of text in paragraphs using CSS. When it comes to styling text on a website, one of the basic and common styling options is changing the case of the text, and we can do this easily with the text-transform property in CSS. The text-transform property can take one of the following values − "capitalize" will capitalize the first letter of each word in the selected element. "uppercase" will ... Read More

How to change link color in CSS?

Shabaz Alam
Updated on 09-Mar-2023 17:48:34

5K+ Views

A link, refers to the HTML anchor element, represented by the tag. This element is used to create hyperlinks that allow users to navigate between web pages and other resources. CSS (Cascading Style Sheets), is a powerful language used to control the visual presentation of web pages. One of the most important things we can do with CSS is changing the color of links on the webpage. In this article, we will cover different ways to change the color of links in CSS. By using "a" selector This is the basic way to change the color of ... Read More

How to change image on hover with CSS?

Shabaz Alam
Updated on 09-Mar-2023 17:42:20

19K+ Views

The "hover" pseudo-class is used to select and apply styles to an HTML element when a user hovers their mouse over it. Changing an image on hover with CSS is a simple process that can add an extra layer of interactivity to the website. Here, we will learn step-by-step guide to changing an image on hover with CSS − Prepare the images The first step in changing an image on hover using CSS is to have the two images you want to use: the default image and the hover image. Make sure these are both saved on your website ... Read More

Advertisements