Imran Alam has Published 54 Articles

What is difference between forEach() and map() method in JavaScript?

Imran Alam

Imran Alam

Updated on 01-Jul-2022 12:58:19

40K+ Views

JavaScript provides several ways to loop through arrays and objects. The most common way is the for loop, which is used to iterate through the elements of an array or object. However, there are other ways to loop through arrays and objects, such as the forEach() and map() methods.The forEach() ... Read More

How to run a given array of promises in series in JavaScript?

Imran Alam

Imran Alam

Updated on 01-Jul-2022 12:44:42

880 Views

In JavaScript, there is a method called "Promise.all" that allows you to run an array of promises in parallel. However, sometimes you may want to run your promises in series instead. This can be useful if you want to make sure that each promise is executed one after the other, ... Read More

How to get the first non-null/undefined argument in JavaScript?

Imran Alam

Imran Alam

Updated on 01-Jul-2022 12:37:05

3K+ Views

In JavaScript, there are often times when we need to find the first non-null/undefined argument in a function. This can be a tricky task, but luckily there are a few methods that can help us accomplish thisUsing Array.prototype.find()One method that can be used to get the first non-null/undefined argument in ... Read More

How to return HTML or build HTML using JavaScript?

Imran Alam

Imran Alam

Updated on 01-Jul-2022 12:31:15

15K+ Views

When building web applications, there are often times when you need to dynamically generate HTML on the client-side. This can be done using JavaScript, and there are different ways to go about it. In this article, we'll show you how to return HTML or build HTML using JavaScript.Returning HTML from ... Read More

How to calculate GCD of two or more numbers/arrays in JavaScript?

Imran Alam

Imran Alam

Updated on 01-Jul-2022 12:25:50

539 Views

The greatest common divisor (GCD) of two or more numbers, also known as the greatest common factor (GCF) or highest common factor (HCF), is the largest positive integer that divides a given number without a remainder. In other words, the GCD is the largest number that is a divisor of ... Read More

How to convert a string into an integer without using parseInt() function in JavaScript?

Imran Alam

Imran Alam

Updated on 01-Jul-2022 12:06:56

2K+ Views

The parseInt() is a built-in function in JavaScript that parses a string and returns an integer. However, there are times when we want to convert a string into an integer without using this function. In this article, we'll explore how to do just that.Using the unary plus operatorOne way to ... Read More

How to return true if the parent element contains the child element in JavaScript?

Imran Alam

Imran Alam

Updated on 01-Jul-2022 08:51:52

6K+ Views

In this tutorial, we are going to look at how we can return true if the parent element contains the child element in JavaScript. Assuming you have two HTML elements, a parent element, and a child element, and you want to know if the parent element contains the child element.Using ... Read More

What is difference between Microtask Queue and Callback Queue in asynchronous JavaScript?

Imran Alam

Imran Alam

Updated on 01-Jul-2022 08:41:46

3K+ Views

In asynchronous JavaScript, there are two ways to schedule tasks – microtask queue and callback queue. Both queues are handled differently by the JavaScript engine.Microtask QueueA Microtask queue is a queue of tasks that are executed after the current task. The microtask queue is handled by the JavaScript engine before ... Read More

How to remove elements from an array until the passed function returns true in JavaScript?

Imran Alam

Imran Alam

Updated on 01-Jul-2022 08:33:48

368 Views

In JavaScript, there are various ways to remove elements from an array until the passed function returns true. In this tutorial, we are going to look at 3 methods in detail.Using Array.prototype.filter()The Array.prototype.filter() method can be used to remove elements from an array until the passed function returns true. Please ... Read More

How to Create a Currency Converter in JavaScript?

Imran Alam

Imran Alam

Updated on 24-Jun-2022 08:33:21

8K+ Views

In this tutorial, we will be discussing how to create a currency converter in JavaScript. We will be discussing the various steps involved in creating such a converter.What is a currency converter?A currency converter is a tool that helps you convert one currency to another. For example, if you are ... Read More

Advertisements