Saurabh Jaiswal

Saurabh Jaiswal

33 Articles Published

Articles by Saurabh Jaiswal

33 articles

How to convert Hex to RGBA value using JavaScript?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 3K+ Views

While designing web pages we use colors to make web pages more appealing and engaging. We commonly use hex code to represent colors but sometimes we need to add transparency to the colors which can be achieved by RGBA values. Hex color values are represented by #RRGGBB and The RGBA color values are represented by rgba(red, green, blue, alpha). Here are a few examples of RGBA and hex values: Input: #7F11E0 Output: rgba(127, 17, 224, 1) Input: #1C14B0 Output: rgba(28, 20, 176, 1) In this article, we will discuss multiple ways to ...

Read More

How to Convert CFAbsoluteTime to Date Object and vice-versa in JavaScript?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 547 Views

CFAbsoluteTime is the elapsed time since Jan 1, 2001, 00:00:00 UTC. This is a standard time format on Apple devices. On the other hand, a date object is a built-in object in JavaScript used to represent date and time values. It has many methods for providing formatting and converting date & time from one form to another. The main difference between CFAbsolute Time and JavaScript Date objects is their reference epoch. CFAbsoluteTime counts seconds since January 1, 2001, whereas JavaScript Date objects count milliseconds since January 1, 1970 (Unix epoch). In this tutorial we will learn how to: ...

Read More

How to convert decimal to hex in JavaScript?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 2K+ Views

Converting decimal numbers to hexadecimal is a fundamental programming task, especially in web development where hex color codes are widely used. JavaScript provides built-in methods and allows custom implementations for this conversion. Using toString() method Using Custom Function Using the toString() Method The toString() method converts a number to its string representation in the specified base. Every JavaScript number has this method available. Syntax Number.toString(radix) Parameters radix (optional): An integer between 2 and 36 specifying the base. For hexadecimal conversion, use 16. Return Value Returns a string ...

Read More

How to convert JavaScript datetime to MySQL datetime?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 2K+ 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 ...

Read More

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

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 61K+ Views

JSON (JavaScript Object Notation) is a powerful data format to exchange data between server and client. HTML tables are essential for displaying data in a structured, readable format. Converting JSON data to HTML tables is a common requirement in web development. In this article, we will learn how to convert JSON data into HTML tables using both vanilla JavaScript and jQuery. We'll explore two practical approaches with complete examples. ...

Read More

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

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 9K+ Views

Converting an array of objects to a flat array is a common task in JavaScript. There are several approaches to extract all values from objects and create a single array containing those values. Let's understand the problem with an example: Given Array of Objects: let carObj = [ { name: "John", car: "Ford" }, { name: "Mark", car: "BMW" }, { name: "Ben", car: "Toyota" } ] Expected Output: ["John", "Ford", "Mark", "BMW", "Ben", "Toyota"] There are multiple ways to achieve this conversion: ...

Read More

How to Convert JSON String to Array of JSON Objects Using JavaScript?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 10K+ Views

To convert JSON string to array of JSON objects using JavaScript is necessary because JSON strings cannot be directly modified or manipulated, so we need this conversion which allows us to access, modify and iterate over each item. We will be discussing three different approaches for this conversion from JSON strings to array of JSON objects. In this article we are having JSON string, our task is to convert JSON string to array of JSON objects using JavaScript. Approaches to convert JSON string to objects Here is a list of approaches to convert JSON string to array ...

Read More

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

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 5K+ 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 the 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 converts it to an array. Syntax $.makeArray(obj) Here obj is an object that we want to convert to an array. Example In this example we ...

Read More

How to convert JSON results into a date using JavaScript?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 8K+ Views

JSON is a powerful data format to exchange data from server to client and vice versa. Many times 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 − ...

Read More

How to convert Map keys to an array in JavaScript?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 13K+ Views

In JavaScript, you can convert a Map's keys to an array using several methods. The most common approaches are using Array.from(), the spread operator, or a for...of loop with Map.keys(). Given a JavaScript Map, the task is to extract all keys and create an array from them. Here's an example: Given Map: Map { 1 => "India", 2 => "Russia", 3 => "USA", 4 => "Japan", 5 => "UK" } Resulting Array: [1, 2, 3, 4, 5] There are multiple ways to achieve this conversion: Using Array.from() and Map.keys() method ...

Read More
Showing 1–10 of 33 articles
« Prev 1 2 3 4 Next »
Advertisements