valueOf 方法 (String)

返回字符串

语法

string.valueOf()

参数

此方法没有参数。

返回值

返回字符串值

备注

在下面的示例中,字符串对象与返回值相同。

var str = "every good boy does fine"; 
var strStr = str.valueOf(); 
if (str === strStr) 
document.write("same"); 
else 
document.write("different"); 
// Output: 
// same

必备条件

在以下文档模式中受支持:怪异模式、Internet Explorer 6标准模式、Internet Explorer 7标准模式、Internet Explorer 8标准模式、Internet Explorer 9标准模式、Internet Explorer 10标准模式、Internet Explorer 11标准模式。应用商店应用(Windows 8和Windows Phone 8.1)中也受支持。See Version Information.

如果你喜欢这篇文章,敬请给站长打赏↑

除特别注明外,本站所有文章均为本站站长原译,转载请注明出处。