AmitDiwan has Published 10744 Articles

How does Implicit coercion differ from Explicit coercion in JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 12:46:53

1K+ Views

In this article, you will understand how implicit coercion differs from Explicit coercion in JavaScript. An implicit coercion is an automatic conversion of values from one datatype to another. It is also known as type conversion. An explicit coercion is the conversion of data type depending on the user's necessity. ... Read More

How does internationalization work in JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 12:45:33

279 Views

In this article, you will understand how internationalization works in JavaScript. Internationalization is the process of preparing software so that it can support local languages and cultural settings. It can include changing the date and time format, changing the metric system format, language format, etc. Example 1 In this example, ... Read More

How does Promise.all() method differs from Promise.allSettled() method in JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 12:44:54

182 Views

In this article, you will understand how does Promise.all() method differs from the Promise.allSettled() method in JavaScript. The Promise.all() method takes in one or multiple promises as input and returns a single Promise. This returned promise fulfills when all of the input's promises are fulfilled. It rejects a promise when ... Read More

How does inline JavaScript work with HTML?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 12:30:02

6K+ Views

In this article, you will understand how inline JavaScript works with HTML. Inline JavaScript represents a code block written in between the tags in a html file. The advantage of using inline JavaScript in HTML files is to reduce the round trip of the web browser to the server. ... Read More

How to remove falsy values from an array in JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 12:23:09

678 Views

In this article, you will understand how to remove false values from an array in JavaScript. An array in JavaScript is a special variable that can hold more than one item. An array can be initialized using the keyword ‘const’ .Falsy values are nothing but boolean false values. Example 1 ... Read More

How to call the key of an object but return it as a method, not a string in JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 12:19:40

779 Views

We can use the "Object.keys()" method to retrieve the keys of an object. However, instead of returning the keys as a string, we can wrap the call to "Object.keys()" in a function. This way, when we call the function, it will return the keys as a method, rather than ... Read More

How to call the loading function with React useEffect?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 12:14:36

14K+ Views

We will use the React useEffect hook to call our loading function. This hook allows us to specify a function that will run on a specific component lifecycle event, such as when the component mounts. By passing in our loading function as a dependency, we ensure that it will be ... Read More

How to call a function from its name stored in a string using JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 12:12:39

10K+ Views

We will use the eval() function to call a function from its name stored in a string. The eval() function evaluates a string as JavaScript code. This allows us to call the function by passing the string containing its name as an argument to the eval() function. Example Here ... Read More

How to call a function repeatedly every 5 seconds in JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 12:00:12

30K+ Views

We will use the setInterval() function to repeatedly call a function every 5 seconds. This function takes two arguments, the first being the function to call and the second being the interval time in milliseconds. JavaScript setInterval setInterval() is a JavaScript function that allows you to execute a function ... Read More

How to calculate the XOR of array elements using JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 11:57:39

3K+ Views

We will use a for loop to iterate through the array. We will initialize a variable called "result" with the value of the first element in the array. For each subsequent element in the array, we will use the XOR operator to update the value of "result" with that element. ... Read More

Advertisements