此方法返回String对象的原始值。
string.valueOf( )
返回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
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)