我試圖創建和初始化AngularJS應用程序內的JavaScript一個二維數組如下:創建和初始化數組二維在javascript
$scope.invalidVote = [];
for (var i = 0; i < $scope.arry1.length; i += 1) {
$scope.answersCount[i] = $scope.arry1[i].arry2.length;
for(var j = 0; j < $scope.arry1[i].arry2.length; j += 1) {
$scope.invalidVote[i][j] = false;
}
}
但它不工作,什麼是應該做的正確方法那?
我認爲$ scope.arry1存在並且是一個數組? – JanS