<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>js清空数组的方法</title>
</head>
<body>
<script type="text/javascript"> let aa= [1,2,3,4] // 方法一
aa.splice(0) console.log(aa); // 方法二
aa = []; console.log(aa); // 方法三
aa.length = 0; console.log(aa); </script>
</body>
</html>