Can I display superscript characters in the alert () dialog box?

Can I display superscript characters (not just numbers) in a dialog box alert(), confirm()or prompt()in JavaScript?

For some reason I need to insert text:

2 and then superscript 'n' 2 ^ n

In JavaScript alerts, confirmations and invitations. A quick Google search really helped, but I didn’t quite find a way to display superscript numbers in dialogs using the Unicode \ u00B character, but it does not work with characters

alert('2\u00B2'); shows correctly 2^2
alert('2\u00Bn'); shows 2u00Bn

So the goal is to show a symbol, not a number.


^ is used as Strength and shows that the next character is redefined, just in case someone gets confused.

+3
3

- , " ". " " (\u00B3) (³) a " " (\00B9) (¹) " N" (\u207F) (ⁿ). - , - alert() HTML, , Unicode.

, alert() . , jQuery UI Dialog.

+12

, . , HTML <sup>, .

, "Unicode \u00B" . , , \u00B2 ( "Superscript Two" ). , , , . , \u00B1 ( /).

Unicode , , , .

+2

Unicode UTF-8 ; 00B2 " 2", 00Bn . 1-3: 00B9, 00B2 00B3.

, , . HTML <sup> , , , .

0

Source: https://habr.com/ru/post/1716347/


All Articles