数组与字符串的相互转化
<script type="text/javascript"> var obj="new1abcdefg".replace(/(.)(?=[^$])/g,"$1,").split(",");//字符串转化为数组 var obj2 = "new2abcdefg".split(""); //字符串转化为数组 alert(obj); alert(obj.length); alert(obj instanceof Array); alert(obj.join("")); //数组转化为字符串 </script>
参考:
http://fp-moon.iteye.com/blog/1186924(以上内容转自此篇文章)