title: How to iterate through angular $scope variables with a for loop
body: <p>I want to iterate through an array using for loop instead of using foreach in which i m not able to break the loop. But here in for loop i getting $scope.items[i] as undefined!
  here i m dynamically adding values in the array based upon the condition.</p>
  
  <pre><code>$scope.items= [{
          name: 'abhishek',
          credit: 1233,
          debit: 0,
          balance: 12
  }];
  for (var i = 1; i &lt;= $scope.items.length; i++) {
          console.log($scope.items.length);
          if ($scope.selectedName.value === $scope.items[i].name) {
              console.log($scope.items[i].name + "forif" + true);
              break;
          }
          else {
              console.log($scope.items[i].name + "forelse " + false);               
              break;                
          }
  }
  </code></pre>