var a=new Array(1,3,2,4,5);
var b=new Array("a","b","c");
console.log(a); //[1, 3, 2, 4, 5]
console.log(a.join("."));//1.3.2.4.5 /* join转字符串*/
console.log(a);//[1, 3, 2, 4, 5]
console.log(a.reverse());//[5, 4, 2, 3, 1] /*reverse翻转数组*/
console.log(a);//[5, 4, 2, 3, 1]
console.log(a.sort());//[1, 2, 3, 4, 5] /*sort排序*/
console.log(a);//[1, 2, 3, 4, 5]
console.log(a.concat(b));//[1, 2, 3, 4, 5, "a", "b", "c"] /*concat将数组合并并返回结果*/
console.log(a);// [1, 2, 3, 4, 5]
/* var c=new Array(1,3,2,4,5,"a","b","c");
console.log(c.indexOf("b"));*/
/*indexOf() 单个参数的时候 在字符串里面查找字符 找到返回当前的索引位置 没找到返回-1*/
/*indexOf 两个参数 查找字符 从那个位置开始*/
/*lastindexOf() 用法和indexOf一致 只不过从后到前查找*/
console.log(a.push("B")); //6 /* push 方法:给数组追加元素 返回新的长度*/
console.log(a); //[1, 2, 3, 4, 5, "B"]
console.log(a.unshift("A"));//7 /*unshift 给数组元素之前追加*/
console.log(a);//["A", 1, 2, 3, 4, 5, "B"]
console.log(a.pop());//B /*pop() 删除数组的最后一个元素*/
console.log(a);//["A", 1, 2, 3, 4, 5]
console.log(a.shift());//A /*shift 删除第一个元素*/
console.log(a);//[1, 2, 3, 4, 5]
console.log(a.slice(1,3));// [2, 3] /*slice 截取数组的某一段 两个参数start end 不取end参数的索引位*/
console.log(a);//[1, 2, 3, 4, 5]
console.log(a.splice(2,1,"a"));//[3] /*splice 从那个位置开始截取几个长度*/
console.log(a);//[1, 2,"a",4, 5]
console.log(a.toString());//1,2,a,4,5 /*toString() 把数组转化为字符串*/
console.log(a);// [1, 2,"a",4, 5]
/*console.log(a.valueOf());*/
var c="a=10&b=10"; /*split 将字符串以什么分割为数组,取第几位*/
console.log(c.split("&")[0].split("=")[1]);//10