<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>array-api</title> </head> <body> </body> <script> var array = ["one", "two", "four"]; console.log(JSON.stringify(array));//["one","two","four"] //在指定位置添加元素,第一个参数指定位置,第二个参数指定要删除的元素,如果为0,则追加 array.splice(2, 0, "three"); console.log(JSON.stringify(array));//["one","two","three","four"] </script> </html>