<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
var arr=[1,2,3,4,5,6,7,8];
//1.中间删除
/*arr.splice(2, 3);
alert(arr);*/
//2.中间插入
/*arr.splice(5, 0, 'a', 'b', 'c');
alert(arr);*/
//3.替换
arr.splice(1, 2, 'a', 'b');
alert(arr);
</script>
</head>
<body>
</body>
</html>