code: function countChildScopes() {
      // jshint validthis: true
      var count = 0; // exclude the current scope
      var pendingChildHeads = [this.$$childHead];
      var currentScope;
  
      while (pendingChildHeads.length) {
        currentScope = pendingChildHeads.shift();
  
        while (currentScope) {
          count += 1;
          pendingChildHeads.push(currentScope.$$childHead);
          currentScope = currentScope.$$nextSibling;
        }
      }
  
      return count;
    }
docs: ------------------------------------------------------------------------------------------ // 
  @ngdoc method
  @name $rootScope.Scope#$countChildScopes
  @module ngMock
  @description
  Counts all the direct and indirect child scopes of the current scope.
  
  The current scope is excluded from the count. The count includes all isolate child scopes.
  
  @returns {number} Total number of child scopes.