I'm converting a guid and then I'm converting it in base 16 with parseInt(), then I display it to generate a short guid.
It's working fine in Chrome and FireFox, but not in IE.
Here's the code:
var guid32 = function () {
"use strict";
return "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c === "x" ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
};
var shortGuid = function () {
"use strict";
return parseInt(guid32(),16).toString(36);
};
for(var i =0; i < 100; i++)
{
$("#guids").append("<p>"+ shortGuid() +"</p>")
}
Here's the implementation of guid32().
Here's the fiddle to test: https://jsfiddle.net/domwu51r/
Why is it different in IE and how can I solve it?
I'm guessing that the implementation in IE of toString() is different of Chrome and FireFox.
How can I keep the generated guid whitout the scientific notation?
------------------------------EDIT---------------------------------
The other given answer does not help me solve the problem. I'm already using toString(36), so it's not the good answer for my question. Also, it's not explainning why it's happening only in IE and not in the other browsers.