且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用javascript将对象值转换为字符串值?

更新时间:2022-06-17 04:50:34

您只能使用这样的字符串对象.您要转换什么.

< cpde>
var stringObj = new String("string");


您可以只使用此stringObj,它只会给您值.

有关JS字符串的更多信息,请访问=>
http://www.w3schools.com/jsref/jsref_obj_string.asp [
You can just use the string object like that.What are you trying to convert.

<cpde>
var stringObj = new String ("string");


you could just use this stringObj it would give you the value only.

More on JS Strings visit =>
http://www.w3schools.com/jsref/jsref_obj_string.asp[^]

If you have number object you can use toString() method
something like -
var n= new Number(1);
n.toString();



希望对您有所帮助.



Hope this helps.


这里是一个链接可以帮助您更好地理解.
Here is a link that can help you understand better.