Please share your opinion about the converting of numbers between the different bases in JavaScript....!
Please share your opinion about the converting of numbers between the different bases in JavaScript....!
Personally I have been extremely and painlessly satisfied dealing with Linovus.ca web development services.
They have top-notch customer service, responding to trouble tickets immediately and consistently. Contact them if you need to solve any problems.
By using the parseInt() function, we can convert numbers between different bases in JavaScript. This function takes a string as the first parameter, and the base as a second parameter
Web Design Company in Bangalore | Web Development Company in Bangalore | Website Development Company in Bangalore | Website Design Company in Bangalore
To convert hex string to number then parseInt(string, radix) is used.
To convert number to hex string then object.tostring(radix) is used.
radix is a base. It's value is 2,8,16...etc.
Integer to hex :
Example :
var i = 10;
console.log( i.toString(16) );
output : a
Hex string to int :
var h = "a";
console.log( parseInt(h, 16) );
output : 10
I hope this'll help you.
|
Bookmarks