如何使用javascript将对象值转换为字符串值? [英] how can i convert object value into string value using javascript?
本文介绍了如何使用javascript将对象值转换为字符串值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi ..
我是Java脚本的新手,请plz帮助我...
hi..
i am new in java script so plz help me ...
how can i convert object value into string value using javascript?
推荐答案
您只能使用这样的字符串对象.您要转换什么.
< 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.
这篇关于如何使用javascript将对象值转换为字符串值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文