該方法返回一個String對象的原始值。
語法
string.valueOf( )
下麵是參數的詳細資訊:
- NA
返回值:
- 返回一個String對象的原始值。
例子:
<html>
<head>
<title>JavaScript String valueOf() Method</title>
</head>
<body>
<script type="text/javascript">
var str = new String("Hello world");
document.write(str.valueOf( ));
</script>
</body>
</html>
這將產生以下結果:
Hello world
