sup()

优质
小牛编辑
114浏览
2023-12-01

描述 (Description)

此方法会将字符串显示为上标,就好像它位于标记中一样。

语法 (Syntax)

其语法如下 -

string.sup( )

返回值 (Return Value)

返回带有标记的字符串。

例子 (Example)

请尝试以下示例。

<html>
   <head>
      <title>JavaScript String sup() Method</title>
   </head>
   <body>
      <script type="text/javascript">
         var str = new String("Hello world");
         alert(str.sup());
      </script>
   </body>
</html>

输出 (Output)

<sup>Hello world</sup>