Please note that this question already has an answer here but the answer is provided in jQuery, I need similar thing to be done with vanilla javascript.
Here's my issue in detail. I have a price string to display in a page which will be in html as <span>60.00</span> I want to transform the string into something like this <span>60,<sup>00</sup></span>.
Here's the code I have tried.
let value = "60.00";
value = value.replace(".", ",");
let values = value.split(',');
var tag = document.createElement("sup");
var text = document.createTextNode(values[1]);
text = tag.appendChild(text);
let text1 = JSON.stringify(text);
alert(values[0]+text1);
If I run this code I get 60{} as an output. 60,⁰⁰ this is the desired output.