删除数组指定位置的元素


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>数组操作</title>
<script type="text/javascript" src="js/jquery.min.js"></script> <!--引入一个jQuery插件-->

</head>
<style>

</style>
<body>
	
</body>
<script type="text/javascript">
	let arr=[1,2,3,4,5]
	console.log("arr原数组",arr)
	let index=2 
	arr.splice(index,1)
	console.log("arr删除index位置后的数组",arr)

</script>
</html>

猜你喜欢

转载自blog.csdn.net/spring_007_999/article/details/127263545