Core JavaScript 1.5 Reference:Global Functions:String
From MDC
目录 |
[编辑] 简介
Core Function
将指定值转换成字符串.
[编辑] 语法
String(val)
[编辑] 参数
-
val - A value.
[编辑] 描述
String 是一个全局函数(对象)而且不与其他对象有关联。它也是String对象的构造器String 。
The String method converts any value into a string; it returns the same value as the initial, natively defined toString method of an individual object.
When the value is a Date object, String returns a more readable string representation of the date. Its format is: Thu Aug 18 04:37:43 Pacific Daylight Time 1983.
[编辑] Examples
[编辑] 例子: 将一个 Date 对象转换成可读取的字符串
下面的例子将 Date 对象转换成了字符串。
d = new Date(430054663215); alert(String(d));
这将会显示一个警告框This displays a dialog box containing "Thu Aug 18 04:37:43 GMT-0700 (Pacific Daylight Time) 1983".