在此插入代码
<script> var arr = [1, 2, 3.14, 'Hello', null, true]; //alert(arr.length); arr.length = 7; alert(arr); console.log(arr); / 控制台打印出的结果是[1, 2, 3.14, "Hello", null, true],而不是[1, 2, 3.14, "Hello", null, true,undefined],这是为什么? / </script>
Sign in to make a reply
Felix_NSY
<script> var arr = [1, 2, 3.14, 'Hello', null, true]; //alert(arr.length); arr.length = 7; alert(arr); console.log(arr); / 控制台打印出的结果是[1, 2, 3.14, "Hello", null, true],而不是[1, 2, 3.14, "Hello", null, true,undefined],这是为什么? / </script>