Q:

JS sup() displaying tags in html

Im a using .sup() function in Javascript to convert a text to superscript. However, when I load the webpage ; it shows the text along with the  tags and no sign of a superscript.
outputtext[2] = "O(n"+"3".sup()+")";

This is what gets displayed on the webpage .
O(n<sup>3</sup>)

I want 3 to be displayed as a superscript. How can it be solved ?
EDIT:
This is how I am printing contents of outputarray .
inner.textContent = outputtext[(Math.log(tile.value) / Math.LN2)] || '';

I call textContent separately later .

A:

My guess would be that you are inserting outputtext[2] into the page via the .textContent property of an element. This will insert the string as is into the element without parsing & rendering it as HTML. 
For situations like this, there is an innerHTML property. Once this property is modified, it's value is rendered as HTML and any tags found within the value will be displayed as expected.
element.textContent = outputtext[2];  // bad
element.innerHTML = outputtext[2];    // good, will display 3 as superscript

If you're using jQuery, use .html() instead of .text()
$(ele).html(outputtext[2]);

