描述
此方法会导致字符串显示为上标,就像它在 <sup> 标签中一样。
语法
它的语法如下 -
string.sup( )
返回值
返回带有 <sup> 标签的字符串。
例请尝试以下示例。
<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>
输出
<sup>Hello world</sup>