1. splice 增,删,改
    2. /*shift pop*/
    3. var arr = [4,5,6,7,8]
    4. /*
    5. splice(index,howmany)
    6. index--从那个下标开始删除
    7. howmany删除几个
    8. */
    9. arr.splice(2,2)
    10. console.log(arr)
    1. /*
    2. 修改 "vue"
    3. splice(index,howmany,value)
    4. index 下标
    5. howmany 删除多少个
    6. value 替代的值
    7. */
    8. var arr = ["html","css","javascript"];
    9. arr.splice(1,1,"vue")
    10. console.log(arr)
    1. /*splice 增加
    2. 从下标的前面添加
    3. splice(index,0,value...)
    4. */
    5. var arr = [3,4,5,6]
    6. arr.splice(2,0,"html","css");
    7. console.log(arr)
    1. /*增,删,改,*/
    2. var arr = [3,4,5,6];
    3. /*
    4. [3,4,"html",5,6]
    5. splice(index,0,value)
    6. */
    7. arr.splice(2,0,"html");
    8. console.log(arr)
    9. /*
    10. 删除
    11. splice(index,howmany)
    12. */
    13. var test = [1,2,3,4,5]
    14. //[1,4,5]
    15. test.splice(1,2);
    16. console.log(test)
    1. var arr = [2,3,4,5]
    2. //[2,3,"vue",5]
    3. //arr.splice(index,howmany...value)
    4. arr.splice(2,1,"vue")
    5. console.log(arr)