Saurabh Jaiswal has Published 43 Articles

How to convert NaN to 0 using JavaScript?

Saurabh Jaiswal

Saurabh Jaiswal

Updated on 21-Feb-2023 17:06:20

4K+ Views

We can use the logical OR operator, double bitwise NOT operator, strict equality operator, or the inNaN() function to convert NaN to 0 using JavaScript. NaN in Javascript means Not a Number, whose type is Number but actually, it is not a number. In this article, we will learn to ... Read More

How to convert Map keys to an array in JavaScript?

Saurabh Jaiswal

Saurabh Jaiswal

Updated on 21-Feb-2023 17:04:43

12K+ Views

There are different ways to convert a map keys to an array in JavaScript. You can use the map keys() method to access the keys in a map and then apply the Array form() method to create an array of the accessed keys. You can also apply the spread operator ... Read More

How to convert JSON results into a date using JavaScript?

Saurabh Jaiswal

Saurabh Jaiswal

Updated on 21-Feb-2023 17:00:43

6K+ Views

JSON is a powerful data format to exchange data from server to client and vice versa. Many time JSON data is received in a String format and we need to convert it to a usable JSON object. In this process, it’s an important requirement to convert string data into Date ... Read More

How to convert list of elements in an array using jQuery?

Saurabh Jaiswal

Saurabh Jaiswal

Updated on 21-Feb-2023 16:59:26

4K+ Views

We can use jQuery.makeArray() method or jQuery.each() method to convert a list of elements into an array using jQuery. The makeArray() method is most convenient way to perform this task. This method is used to convert an object into a native array. Using jQuery makeArray() method The $.makeArray() method ... Read More

How to convert JSON string to array of JSON objects using JavaScript?

Saurabh Jaiswal

Saurabh Jaiswal

Updated on 21-Feb-2023 16:57:22

9K+ Views

JSON is used to exchange data from client to server. JSON is so lightweight and it is easy to read for a human and also easy for a machine to parse and generate. Many times we get data in string format and we need to convert that data into an ... Read More

How to convert Object’s array to an array using JavaScript?

Saurabh Jaiswal

Saurabh Jaiswal

Updated on 21-Feb-2023 16:55:01

7K+ Views

We can use the Object.values() method, Array puch() method and for…of loop to convert Object’s array to an array using JavaScript. First we access each object using for…of loop and then apply the Object.values() method to access the values of individual object. Then use the Array push() method to add ... Read More

How to convert JavaScript datetime to MySQL datetime?

Saurabh Jaiswal

Saurabh Jaiswal

Updated on 21-Feb-2023 16:49:21

997 Views

Date time manipulation in JavaScript is important while dealing with databases. JavaScript Date and time are different from the MySQL date and time. JavaScript provides multiple ways to represent Date and time none of these formats are the same as MySQL's date and time format. In this article, we will ... Read More

How to call a JavaScript function on a click event?

Saurabh Jaiswal

Saurabh Jaiswal

Updated on 06-Jan-2023 14:26:11

16K+ Views

To call a function on click event in JavaScript, you can use either the addEventListener method or the onclick event attribute. The addEventListener method is a general way to attach an event handler to a DOM element, and it allows you to specify the event and the callback function to ... Read More

How to call jQuery function with JavaScript function?

Saurabh Jaiswal

Saurabh Jaiswal

Updated on 06-Jan-2023 14:23:53

13K+ Views

JavaScript is the core of any website, it adds functionalities to a website, make the overall website responsive. But in JavaScript, it is hard to select an element and add different functions like toggling an element, fade-in an element, and more. jQuery provides many methods for making it easy to ... Read More

How to calculate the nth root of a number in JavaScript?

Saurabh Jaiswal

Saurabh Jaiswal

Updated on 06-Jan-2023 13:32:57

909 Views

We have given a number and the task is to calculate the nth root of that number using JavaScript. We have multiple ways to achieve this, some of which are the following. Using Math.pow() Method Using Logarithm To get the nth root of a number firstly let’s understand ... Read More

Advertisements