JAVASCRIPT:
function identifybrand ( allproducts,favBrand){
var favBrandList = new Array();
var prodType = document.getElementById('prodType').value;
for (var i=0;i<=allproducts.length;i++) {
if (favBrand == allproducts[i].brandName) {
favBrandList.push(allproducts[i]);
}
}
alert(favBrandList);
}
我无法访问 for 循环外的 favBrandList 数组。有谁知道为什么我无法访问它?