数组头部,尾部添加数据和删除指定位置下标的元素
//unshift() 方法可向数组的开头添加一个或更多元素,并返回新的长度。 //将新项添加到数组起始位置: var fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits.unshift("Lemon","Pineapple"); //将新项添加到数组末尾位置: var fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits.push("Lemon","Pineapple"); //删除数据 let arr = ["james","irving","kobe","wade"]; arr.splice(1,1) //在下标1处开始删除,删除一位 console.log(arr);// irving被删除