Shubham Vora

Shubham Vora

793 Articles Published

Articles by Shubham Vora

Page 37 of 80

How to use Regex to get the string between curly braces using JavaScript?

Shubham Vora
Shubham Vora
Updated on 06-Mar-2023 6K+ Views

We can create a regular expression so it can find all the substrings between the curly braces. After that, we can use the exec() or match() method to extract the matching substring. In this tutorial, we will learn to use a regular expression to get the string between curly braces using JavaScript. For example, if we have given a string like ‘This is a {string} with {curly} braces, we need to extract all substrings that reside between the curly braces. Using the exec() method with a regular expression to get the string between curly braces The exec() ...

Read More

How to use Radio Component in Material UI?

Shubham Vora
Shubham Vora
Updated on 06-Mar-2023 3K+ Views

The radio button is used to allow users to choose any one value among a group of values. For example, the best use case of the radio button is allowing users to choose a gender in the form. The material UI provides the pre-designed Radio component, which we can use to create a group of radio buttons. Users can use the below command in the terminal to install the Material UI library in the React project. npm install @mui/material @emotion/react @emotion/styled Syntax Users can follow the syntax below to use the Radio component of the ...

Read More

How to use Particle.js in JavaScript project?

Shubham Vora
Shubham Vora
Updated on 06-Mar-2023 2K+ Views

As the name suggests, the Particle.js library allows us to add particles to a particular HTML element. Also, we can change the shape of the particles number of particles in the div. We can add animation or motion to particles using the Particle.js library. Here, we will learn to change the shape, colour, and motion of particles via different examples. Syntax Users can follow the syntax below to use the Particle.js library in a JavaScript project. tsParticles.load("id", { particles: { // properties for the ...

Read More

How to sorting an array without using loops in Node.js?

Shubham Vora
Shubham Vora
Updated on 06-Mar-2023 1K+ Views

In Node.js, a built-in sort() method is available to sort an array without a headache. However, as a beginner to learn how the sort() method works internally, users should learn various sorting algorithms. In this tutorial, we will learn a different algorithm to sort an array without using loops in NodeJS. Use the setInterval() method The setInterval() method allows us to invoke any particular function after each interval. Also, we can store the id of the setInterval() method in any variable and use it later to clear the interval. So, we can call a callback function in the ...

Read More

How to create a dynamic search box in ReactJS?

Shubham Vora
Shubham Vora
Updated on 06-Mar-2023 4K+ Views

Search is one of the most important functionalities of the website. It allows users to filter products and search for specific things on the website, reducing the time users find particular things on the website. For example, you can see a search bar at the top of this page. Whenever we enter any search input, it shows us a search result by filtering the courses and tutorials based on the search result. This tutorial will teach us to implement dynamic search from scratch in ReactJS. Use the AutoComplete Component of Material UI The Material UI library contains various ...

Read More

How to use polyfill in JavaScript?

Shubham Vora
Shubham Vora
Updated on 01-Mar-2023 2K+ Views

The developers of JavaScript always keep adding new features to the JavaScript language to improve performance and add better functionalities. Sometimes, it happens that new features don’t support by the old browser versions. For example, the exponential operator is introduced in ES7, and the trailing comma in the object is also valid in ES7. Now, while developing the application, we have added used the exponential operator in the application. It will work with the newer versions of the browser, but if someone is using a very old version of the browser, they can get errors like the exponential operator is ...

Read More

How to write and use for loop in Vue js?

Shubham Vora
Shubham Vora
Updated on 28-Feb-2023 8K+ Views

Vue JS is an open-source JavaScript framework. It is used to create single-page apps and user interfaces. The component-based architecture of Vue Js uses separated, reusable elements called components to encapsulate HTML, JavaScript, and CSS. This enables the usage of a virtual DOM to boost performance while also helping efficient and maintainable code. Vue Js’s reactivity system, which allows it to immediately refresh the user interface when the underlying data changes, is one of its distinguishing characteristics. The “v-for” directive in Vue Js renders elements from iterating over arrays or objects based on the item looped over. Depending on the ...

Read More

Implement polyfill for String.prototype.trim() method in JavaScript

Shubham Vora
Shubham Vora
Updated on 28-Feb-2023 459 Views

Some old versions of the browsers or old browsers themselves don’t support the newly evolved features of JavaScript. For example, if you are using a very old browser version, it doesn’t support the features of the ES10 version of JavaScript. For example, some versions of the browser don’t support Array.falt() method, introduced in the ES10 version of JavaScript, to flatten the array. In such cases, we need to implement user-defined methods to support that features by the old browser version. Here, we will implement the polyfill for the trim() method of the String object. Syntax Users can follow the ...

Read More

Implement polyfill for Array.prototype.reduce() method in JavaScript

Shubham Vora
Shubham Vora
Updated on 28-Feb-2023 1K+ Views

The polyfill is a concept to extend the browser's features using user-defined methods. If the user’s browser is not updated, it can happen that browser doesn’t support the newer features of any programming language, such as JavaScript. As a developer, we require to check whether the feature is supported by the browser, and if not, we need to invoke a user-defined method. In this tutorial, we will discuss implementing the polyfill for the array.reduce() method. If any browser doesn’t support the array.reduce() method, we will invoke the userdefined reduce() method. Before we start with the tutorial, Let’s ...

Read More

Implement a JavaScript when an element loses focus

Shubham Vora
Shubham Vora
Updated on 28-Feb-2023 1K+ Views

When we click the input element in HTML, it sets the outline for the input element, focusing on it. Sometimes, we must execute some JavaScript code when the user loses focus from the input element. For example, We can autofocus the input element when the user refreshes the web page using the HTML’s ‘autoFocus’ attribute. After that, we can execute the JavaScript function when an element loses focus to ensure that the input value is not empty. If the input value is empty, and the element loses focus, we can show the error message like ‘This field is required’. ...

Read More
Showing 361–370 of 793 articles
« Prev 1 35 36 37 38 39 80 Next »
Advertisements