#1String();把数组转换成字符串
```
var arr=[1,2,3,4,5];
var str=String(arr); 变量名不带引号
console.log(str);
```
#2join("拼接符");拼接,最后拼接成的是字符串
```
拼接符里面可以是符号
如果没有拼接符,默认等于String;
var arr=["wu","jing","xiang"]; 字母用引号包起来逗号隔开
var str=arr.join("~");
拼在一起的效果,字母中间没有东西
var str=arr.join("");
如果没有拼接符,默认等于String;
var str=arr.join();
console.log(str);
```
#3concat();拼接 结果还为数组
```
var arr=["wu","jing","xiang"];
var arr2=[1,2,3,4,5];
var str=arr.concat(arr2);
或
var str=arr.concat(1,2,3);
console.log(str);
```
#3slice(starti,endi); 截取
```
1.含头不含尾
2.如果省略第二个参数,默认从starti开始截图到尾部
3.如果一个参数都不写,相当于复制原数组
4.支持负数参数
var arr=["wu","jing","xiang","yang","jing","xin"];
0 1 2 -3 -2 -1
var str=arr.slice(1,2);
var str=arr.slice(3);
var str=arr.slice();
var str=arr.slice(-3,-1);
console.log(str);
```
#5.splice(starti,n); 删除 插入 替换
```
var arr=["a","b","c","d","e","f"];
0 1 2 3 4 5
删除 从开始到结束的删除
var str=arr.splice(2,3);
插入 从开始的后面在保持不被删除的情况下插入1,2
var str=arr.splice(2,0,"1","2");
替换 从开始的后面删除两个替换两个
var str=arr.splice(2,2,"A","B");
console.log(str);
console.log(arr);
#6.reverse(); 翻转
```
var arr=[1,2,3,4,5,6,7,8,9];
var str=arr.reverse();
var arr=["你","是","年","少","的","欢","喜"];
var str=arr.reverse(); 括号里不加内容
console.log(str);
```
#**7.push(); 给数组末尾添加元素**
```
var arr=[1,2,3,4,5,6,7,8,9];
var str=arr.push("a",10); 可以添加多个字母和数字
console.log(arr);
```
#**8.pop(); 删除数组末尾的元素,只能删除一个**
```
var arr=[1,2,3,4,5,6,7,8,9];
var str=arr.pop(); 括号里不加东西
console.log(arr);
```
#**9.unshift(); 给数组开头添加元素**
```
var arr=["a","b","c","d","e","f"];
var str=arr.unshift("w","j","x");
console.log(arr);
#**10.shift(); 删除数组开头元素,只能删除一个**
```
var arr=["a","b","c","d","e","f"];
var str=arr.shift();
console.log(arr);
```