Found 8894 Articles for Front End Technology

How to convert NaN to 0 using JavaScript?

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 approaches to convert NaN to Boolean. Using the Logical OR (||) Operator Using the Double Tilde (~~) Operator Using the Strict Equality (===) Operator Using the isNaN() function Using the Logical OR (||) Operator The logical OR (||) operator is used to check the truthiness of ... Read More

How to convert Map keys to an array in JavaScript?

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

13K+ 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 instead of the Array form() method to create an array of key. You are given a javascript Map and the task is to convert the Map’s keys into array. Here is the example given below Given Map − { 1: "India", 2: "Russia", 3: "USA", 4: "Japan", 5: ... Read More

How to convert JSON results into a date using JavaScript?

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

7K+ 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 format. In this article, we will learn how to convert JSON results into a Date string using Javascript. The JSON objects contain the date like this − { name: "John", time: '/Date(1559072200000)/' } And the result will be − Wed May 29 2019 ... Read More

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

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 in jQuery converts an array-like object into a JavaScript array. It takes a single argument and convert it to array. The following is syntax of $.makeArray() method- $.makeArray(obj) Here obj is an object that we want to convert to an array. Here are the steps ... Read More

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

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 array. In this article, we will talk about multiple ways to convert JSON string to array of JSON objects using JavaScript. Using JSON.parse( ) method Using eval( ) function Appraoch 1: Using JSON.parse( ) Method The JSON.parse method is used to Convert JSON strings to ... Read More

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

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 the values to the array. In this article, we will discuss in this approach in detail. Let’s have a look at the example to get an understanding about the problem. You have given an array of objects and the task is to convert the array of object into array ... Read More

How to convert JSON data to a html table using JavaScript/jQuery?

Saurabh Jaiswal
Updated on 31-Oct-2023 21:58:41

54K+ Views

JSON (JavaScript object notation) is a powerful data format to exchange data from server to client and vice versa. HTML tables are powerful tools to represent data in tabular format so that it becomes very easy to read, analyze and compare. It is very common in web development to convert JSON data into HTML tables. In this article, we will learn how to convert JSON data into HTML tables using Javascript as well as jQuery. By the end of this article, you will have a solid understanding of JSON to HTML table conversion. Convert JSON data into HTML tables using ... Read More

How to convert JavaScript datetime to MySQL datetime?

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

1K+ 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 discuss some approaches to converting JS date and time into MySQL date and time format. First of all, we will understand the difference between Javascript and MySQL date and time formats. Here is an example − Javascript − ISO 8601 Date Format : YYYY-MM-DDTHH:mm:ss.sssZ MySQL − ISO ... Read More

How to transform background image using CSS3

Harshit Sachan
Updated on 20-Feb-2023 15:52:46

2K+ Views

HTML stands for Hyper Text Markup Language. It functions as a tool for constructing Web pages as well as an illustration of how one is put together. It consists of a number of parts. Its components provide the browser instructions on how to render the content. The appearance of HTML components in different print and digital media, such as displays and other print and digital forms, is controlled by CSS, or cascading style sheets. Time is significantly reduced when CSS is used. It enables the concurrent control of several web page designs. In this post, we'll discover how to ... Read More

How to create an accordion hover effect with box-shadows in CSS

Harshit Sachan
Updated on 20-Feb-2023 15:48:37

552 Views

Hyper Text Markup Language is what HTML is. It serves as both an example of how a Web page is put together and a tool for creating Web pages. It is made up of several components. Its elements provide instructions to the browser on how to render the content. CSS, or cascading style sheets, define how HTML elements appear in various print and digital media, such as displays and other print and digital forms. The use of CSS considerably reduces time. It allows for the simultaneous management of many webs page designs. This article, we will learn how to ... Read More

Advertisements