Found 8591 Articles for Front End Technology

How to Create a Tab Image Gallery?

Prerna Tiwari
Updated on 02-Mar-2023 16:42:02

3K+ Views

Creating a tab image gallery is a great way to showcase a collection of images on a website. By following the steps outlined in this tutorial, you can easily create a tab image gallery using HTML, CSS, and JavaScript. This gallery can be used to display various images, such as photographs, artwork, or even product images. With a little bit of creativity and customization, you can make the gallery look and function just the way you want it to. Step 1: Create the HTML Structure The HTML structure must be created first in order to construct a tab picture ... Read More

How to create a style tag using JavaScript?

Prerna Tiwari
Updated on 02-Mar-2023 16:37:51

8K+ Views

JavaScript allows developers to create and manipulate style tags in order to change the appearance of a webpage. By using the document.createElement() method, the .sheet property, and the .insertRule() and .deleteRule() methods, we can add, modify, and remove CSS rules from a stylesheet. By combining these techniques with event listeners, we can create dynamic and interactive web pages that can change their appearance in response to user interactions. One of the most powerful features of JavaScript is the ability to manipulate the DOM, which is the structure of a web page. One way to manipulate the DOM is by creating ... Read More

How to create a private variable in JavaScript?

Prerna Tiwari
Updated on 02-Mar-2023 16:11:44

6K+ Views

Closures, Symbols, WeakMaps, class private fields, and Proxies are a few techniques that can be used to create a private variable in JavaScript. Every technique has benefits and drawbacks, so it's crucial to pick the one that best suits your requirements. Like many other programming languages, JavaScript has the idea of private and public variables. Private variables can only be accessed and changed by code that is also part of the same scope, but public variables can be accessed and changed by any code. Let’s look at the different techniques to create a private variable in JavaScript. Using ... Read More

How to create a global Promise Rejection Handler in JavaScript?

Prerna Tiwari
Updated on 02-Mar-2023 16:09:27

1K+ Views

Promise rejection handlers are a powerful tool in JavaScript for handling errors that occur in asynchronous code. In this article, we will learn how to build a global promise rejection handler in JavaScript and how it might assist your application manage errors. You can detect unhandled promise rejections using the global unhandledrejection event and take the necessary action, like logging the problem to an error tracking service or showing the user a notice. A more understandable and simpler syntax for handling promise rejection is provided by error handling with async-await, but it necessitates that you wrap each async function ... Read More

How to create a function from a string in JavaScript?

Prerna Tiwari
Updated on 02-Mar-2023 16:06:43

2K+ Views

Creating a function from a string in JavaScript can be helpful in situations when you need to generate a function dynamically at runtime or when you have a string that contains the code for a function you wish to execute. The ability to construct a function from a string is a useful functionality of JavaScript that allows dynamic function creation at runtime. The eval() function and the new Function() function Object() [native code] are the two most popular methods for doing this, although both have significant security flaws. The Function.prototype.constructor is a safer option even though it is ... Read More

How to convert a plain object into ES6 Map using JavaScript?

Prerna Tiwari
Updated on 02-Mar-2023 16:03:11

343 Views

There are many ways to convert a plain object into an ES6 Map in JavaScript. The simplest and most effective way is using the Object.entries() function and the Map() constructor. In contrast, the more flexible alternatives include Object.keys() and Array.prototype.forEach() and the for...in loop and Map() function method. A Map in ES6 is a collection of key-value pairs. Here we can use any type of object as a key, including primitive data types like strings and numbers. The values in the map can be any type of object. The main difference between a Map and an object is that ... Read More

How to convert a pixel value to a number value using JavaScript?

Prerna Tiwari
Updated on 02-Mar-2023 15:57:49

5K+ Views

Converting pixel values to number values in JavaScript is a simple task that can be accomplished using built-in functions such as parseInt(), parseFloat(), Number() and also string method replace(). Each method has its own advantages and disadvantages and the best method to use will depend on the specific requirements of your project. When positioning and styling items on a web page, it's sometimes required to work with both pixel and numeric values in web development. To execute computations or operations on a value, for instance, you might need to convert a pixel value, such as "100px, " to a ... Read More

How to convert a number into an array in JavaScript?

Prerna Tiwari
Updated on 02-Mar-2023 15:43:42

7K+ Views

In JavaScript, there are many built-in methods that can convert a number into an array. The simplest one is to the split() method. We can also use the map(), reduce(), or form() methods to perform the task. Some of the most popular methods for converting a number into an array are discussed in this article, along with examples of when and how to apply each technique. Now, the question will be, why there can be a need to convert a number into an array? Then the reason could be splitting a phone number into its individual digits or breaking own ... Read More

Form required attribute with a custom validation message in HTML5

Prerna Tiwari
Updated on 02-Mar-2023 15:37:53

20K+ Views

HTML5 includes a number of built-in form validation features that allow developers to easily add validation to their forms. One of these features is the "required" attribute, which specifies that an input field is required and must be filled out before the form can be submitted. The “required” attribute is a boolean attribute. If any input field with the “required” attribute is present in the form, then this field must be completed before submitting the form. If that particular field is left blank before submitting the form, the user will see an error message from the browser informing ... Read More

Introduction to Anime.js

Prabhdeep Singh
Updated on 02-Mar-2023 15:26:19

2K+ Views

Anime.js is a lightweight JavaScript library with a straightforward, effective API. It functions with JavaScript objects, CSS, and DOM elements and also Anime.js is easy to use. Traditionally, we make animations by gradually modifying the styling of an element. Such movements are possible with JavaScript, but even the simplest animations are difficult and time-consuming to develop. Anime.js makes animation easier by offering a variety of tools. It offers capabilities to regulate the timing and user inputs and supports many animations running concurrently on the same object. The majority of popular browsers also support Anime.js. Installation Part of Anime.js ... Read More

Advertisements