這是我的代碼<!DOCTYPE html><html lang="en"><head>
<meta charset="UTF-8">
<title>Document</title></head><body>
<script>
var colors = ['red','blue']; var count = colors.push('green'); console.log(count);
console.log(colors); console.log(colors.length); var item = colors.shift(); </script></body></html>這是打印結果這里有個疑問是數組明明打印出來的是red,blue,green,但把數組展開,為什么只有0: blue 1: green length: 2但后面的數組長度卻打印出3 這是什么問題
js數組問題
慕田峪7331174
2018-09-07 10:08:52