does anyone know how to create a superscript character in node.js? I am trying to superscript '®':
let tm = '®';
let tm = tm.sup();
However, this returns <sup>®</sup>
Can someone help?
Thanks in advance!
does anyone know how to create a superscript character in node.js? I am trying to superscript '®':
let tm = '®';
let tm = tm.sup();
However, this returns <sup>®</sup>
Can someone help?
Thanks in advance!
Unfortunately, you can't. You can display some superscript unicode characters (Ex. ¹²³⁴⁵⁶⁷⁸⁹⁰⁺⁻), but '®'(
\u00AE
) does not have a superscript version.Node.js does not support text styling itself. With terminal support, you can add modifiers / colors / background colors but not superscript. Please check chalk if you are interested.
Please note the
String.prototype.sup()
method is designed for HTML page, that's why it will wrap the text with<sup>
tag. Also, it is deprecated and removed from the Web standard. It should not be used any more.