String() 函数把对象的值转换为字符串。
var test1 = new Boolean(1);
var test2 = new Boolean(0);
var test3 = new Boolean(true);
var test4 = new Boolean(false);
var test5 = new Date();
var test6 = new String("999");
var test7 = 12345;
document.write("var test1 = new Boolean(1); ? ?轉(zhuǎn)為字符串:" + String(test1) + "<br />");
document.write("var test2 = new Boolean(0); ? ?轉(zhuǎn)為字符串:" + String(test2) + "<br />");
document.write("var test3 = new Boolean(true);轉(zhuǎn)為字符串:" + String(test3) + "<br />");
document.write("var test4 = new Boolean(false);轉(zhuǎn)為字符串:" + String(test4) + "<br />");
document.write("var test5 = new Date(); ? ? ? ? ? 轉(zhuǎn)為字符串:" + String(test5) + "<br />");
document.write("var test6 = new String('999'); ?轉(zhuǎn)為字符串:" + String(test6) + "<br />");
document.write("var test7 = 12345; ? ? ? ? ? ? ? ? ?轉(zhuǎn)為字符串:" + String(test7) + "<br />");
轉(zhuǎn)載于:https://www.cnblogs.com/alantao/p/5368089.html
總結(jié)
以上是生活随笔為你收集整理的String() 函数把对象的值转换为字符串。的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Oracle数据库常用技术
- 下一篇: 可爱的情侣名859个