js achieve binary system conversion

Recently met a demand in the project, it is necessary to convert hexadecimal data id display, id is the original decimal, I used this method to convert

var newId = parseInt(oldId,16);

Later xxx number of user feedback data in question, would I put that data back turn back, look at the original id is. I was forced to look ignorant, how turn turn back, then regardless of use parseInt A variety of agonizing, finally I found this method, it is recorded as follows:

var oldId = newId.toString(16);

This will turn back

Published 27 original articles · won praise 6 · views 20000 +

Guess you like

Origin blog.csdn.net/github_37673306/article/details/89921553