Web Assembly (Wasm) with JavaScript

Mukul Latiyan
Updated on 15-Mar-2026 23:19:01

641 Views

Have you ever wondered if it's possible to run high-performance applications on the web without sacrificing the portability and security that JavaScript provides? Well, wonder no more! With the introduction of WebAssembly (Wasm), it is now possible to bring native-like performance to web applications while still leveraging the power of JavaScript. In this article, we will explore the basics of WebAssembly and how it can be used alongside JavaScript to unlock a new world of possibilities. What is WebAssembly (Wasm)? WebAssembly, often referred to as Wasm, is a binary instruction format designed specifically for web browsers. It is ... Read More

How to update an object with setState in ReactJS?

Rushi Javiya
Updated on 15-Mar-2026 23:19:01

3K+ Views

In React, state objects store component data that can change over time. This tutorial covers how to update state objects using both class components with setState() and functional components with hooks. Using setState() in Class Components The setState() method is used to update state in class components. When updating nested objects, use the spread operator to preserve other properties. Syntax this.setState({ student: { ...this.state.student, fees: new_value, }, }); Example: Updating Simple State Object This example shows how to update a ... Read More

Web Components: Building Custom Elements with JavaScript

Mukul Latiyan
Updated on 15-Mar-2026 23:19:01

628 Views

Web components are a powerful tool for building reusable and encapsulated UI elements in web applications. They allow developers to create custom elements with their own markup, style, and behavior, which can be easily reused across different projects and shared with other developers. In this article, we will explore the fundamentals of web components and learn how to build custom elements using JavaScript. What are Web Components? Web components are a set of web platform APIs that allow you to create reusable, encapsulated, and composable UI elements. They consist of three main specifications: Custom Elements, Shadow DOM, and ... Read More

How to Trim White Spaces from input in ReactJS?

Rushi Javiya
Updated on 15-Mar-2026 23:19:01

7K+ Views

We will learn to trim white spaces from the input in ReactJS. Sometimes, users add unnecessary space at the start or end of the input by mistake. So, as a developer, we need to check if the input string contains the white space at the start or end. If we find white spaces in the input, we should trim it; Otherwise, it can cause issues. For example, we need to store the email in the database, and while registering the email, the user has also added the white spaces by mistake, and we stored the email in the database ... Read More

JavaScript Program to Find the average of all positive numbers in an array

AYUSH MISHRA
Updated on 15-Mar-2026 23:19:01

6K+ Views

In this article, we will learn how to find the average of all positive numbers in an array using JavaScript, along with examples to demonstrate the implementation. We are given an array of integers, which may contain both negative and positive numbers. Our task is to calculate the average of all the positive numbers in the array. Problem Description The goal is to compute the average of all positive numbers in a given array. This involves summing up the positive numbers and dividing the sum by the count of positive numbers. Example 1 Input: ... Read More

JavaScript Program to Find Area of a Circle

AmitDiwan
Updated on 15-Mar-2026 23:19:01

20K+ Views

To find area of a circle using JavaScript, we will be using the simple formula: Area = π × r² where r is the radius and π is a constant value pi. In this article, we are having radius of the circle and our task is to find the area of the circle using JavaScript. r center Area = π × r² Example Calculation let radius = 10 and π(pi) = ... Read More

JavaScript Program for Maximize Elements Using Another Array

Prabhdeep Singh
Updated on 15-Mar-2026 23:19:01

306 Views

In this article, we are going to implement a JavaScript program for maximizing elements using another array. We are given two arrays and have to pick some elements from the second array and replace the elements of the first array to maximize the sum. Problem Statement In this problem, we are given two arrays and we have to make all the elements of the first array as large as possible by replacing them with elements from the second array. Each element from the second array can only be used once. The goal is to maximize the sum of ... Read More

How to create an array with multiple objects having multiple nested key-value pairs in JavaScript?

Tarun Singh
Updated on 15-Mar-2026 23:19:01

6K+ Views

JavaScript is a versatile language that is widely used for creating dynamic web applications. One of the most common data structures used in JavaScript is the array. An array is a collection of elements that can be of any type, including objects. In this article, we will discuss how to create an array with multiple objects having multiple nested key-value pairs in JavaScript. What are arrays? An array is a special type of object that stores a collection of values. These values can be of any data type, such as numbers, strings, booleans, and even other arrays. Arrays ... Read More

How to validate a Date in ReactJS?

Rushi Javiya
Updated on 15-Mar-2026 23:19:01

4K+ Views

Sometimes, we require to take the date from the users in string format. Users can make mistakes while entering the date value into the input field, so we need to validate the date string in our application code. Below, we will learn various solutions to validate dates in ReactJS. Using the Validator NPM Package The Validator is an NPM package that contains various methods to validate strings. It includes the isDate() method to validate date strings with any delimiter. It also contains methods to validate emails and phone numbers. Use the below command to install the ... Read More

How to Validate an Email in ReactJS?

Rushi Javiya
Updated on 15-Mar-2026 23:19:01

7K+ Views

Email validation is an important feature we need to add to authentication forms. Nowadays, most applications use email and a one-time password for authentication. If the user enters the wrong email, they should not be able to authenticate themselves. Also, we need to validate the email while getting the user's email via contact forms. The user may enter the wrong email format due to some mistake. To correct users' mistakes, we can alert them by showing an error message. Below, we will learn two approaches to validate email addresses in ReactJS using different methods. Using the validator ... Read More

Advertisements