我试图遍历这个数组,但它不返回任何长度。可能吗?
谢谢!
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">click</button>
<script>
function myFunction()
{
var fruits = [];
fruits["B"] = "Banana";
fruits["A"] = "Apple";
fruits["O"] = "Orange";
delete fruits["A"];
alert(fruits["A"]); // Alerts "undefined"
alert(fruits["B"]); // Alerts "Banana"
alert(fruits.length); // Alerts "0"
}
</script>
</body>
</html>