title: variables not hoisting as expected in angularjs
body: <p>I've been following John Papa and his angular style guide recommendations.  I like the idea of putting all of your variables and methods available to the view up at the top of the controller and rely on javascript to hoist the variables at run time.  I clearly don't understand hoisting as well as I thought I did though.  In the following example I would expect the dumbValue variable declaration to be hoisted above the $scope.dumbValue assignment statement;</p>
  
  <pre><code>var app = angular.module('plunker', []);
  app.controller('MainCtrl', [$scope, $http]);
  function MainCtrl($scope,$http)
  {
      $scope.dumbValue = dumbValue;
      var dumbValue = 'dumb';
  }
  </code></pre>
  
  <p>But in <a href="http://plnkr.co/edit/iCC3j6QgGQfbwwJXZkdd?p=preview" rel="nofollow">this Plunker</a> you can see that that is not the case; The select ng-model value is not initialized.
  If you move the assignment statement under the variable declaration, the ng-model is initialized.</p>
  
  <p>Why doesn't javascript hoist the <code>var dumbValue</code> above the assignment, or is it and there's something about the way angular deals with it that I don't understand?</p>