# [Code Example] Convert hexadecimal number into decimal in JS & Reactjs

To convert a hexadecimal number into decimal in javascript and reactjs, you can use `parseInt()` function with `base 16`. It will take care of provided data if it is in string form too. Check this code example –

``````function hexToDecimal(x) {
const parsed = parseInt(x, 16);
if (isNaN(parsed)) { return 0; }
return parsed;
}

console.log(hexToDecimal(' 0xFA50C'));
// expected output: 1025292

``````

Source: MSDN

Get only the best articles delivered to your mail

## attributeerror: ‘localstack’ object has no attribute ‘__ident__func__’

In this article we will quicky resolve attributeerror: ‘localstack’ object has no attribute ‘__ident__func__‘. This issue arose in flask-sqlalchemy. Solution 1. For non-docker builds First uninstall flask-sqlalchemy – Then install…

## [Code Example] Get who is logged in on your system linux & windows bash

In this article we will show you the code to get who is logged in to your windows, linux, mac or Ubuntu operating system. Use whoami command in terminal to…

## [Code Example] “import matplotlib.pyplot as plt” will import matplotlib

Many people asks what line of code is used to import matplotlib? Here we are going to provide you the code for it. Code Example – Using it for drawing…

## [Code Example] valueerror could not convert string to float

In this article we will provide you some code examples to resolve valueerror could not convert string to float. According to the error, you must be trying to convert some…

## [Code Example] How to create progress bar using bash script

In this bash script code article you will see how to create a progress bar. This is a fine example to show download progress, loaders, waiting etc. This function accepts…

## [Code Example] Toggle between two values using bash script

Get bash script code to toggle between two values. This code is best suited for situations where you want to toggle the state of a switch from on/off. It can…