js 数组链接用concat
<script type="text/javascript">
var arr1=[1,2,3];
var arr2=[6,7,8];
alert(arr1.concat(arr2));
</script>
js 数组转成字符串
<script type="text/javascript">
var arr=[1,2,3,4];
alert(arr.join('-'));
</script>
js 字符串转数组
<script type="text/javascript">
var str='12-4-5-8';
var arr=str.split('-');
//'12-4-5'.split('-') ['12','4','5']
alert(arr[0]+arr[1]);
</script>
网友评论