Is it possible to display superscripted characters (not only numbers) in the alert()
, confirm()
or prompt()
dialogue boxes in JavaScript?
Due to some reasons I need to insert a text:
2 followed by superscripted 'n' 2^n
Into JavaScript alert, confirm and prompt boxes. Fast google searching did help but not exactly I found a way to display superscripted numbers in dialogue boxes using Unicode \u00B character but it doesn't work with characters
alert('2\u00B2'); shows correctly 2^2
alert('2\u00Bn'); shows 2u00Bn
So the goal is to show a character superscripted not the number.
^ is used as Power and to show that next character is superscripted, just in case someone gets confused.