title: What's the difference between $scope.myScope = function () and function () in AngularJS
body: <p>I've recently gone into developing with AngularJS. It's confusing to me the different between these two: </p>
  
  <pre><code>$scope.myScope = function () { 
   var x = 'do something with variable here';
   $scope.anotherScope = x;
  };
  </code></pre>
  
  <p>and </p>
  
  <pre><code>function myFunction () {
   var x = 'do something with variable here';
   $scope.anotherScope = x;
  }
  </code></pre>
  
  <p>They both seem to be able to do the same thing (I use them a lot inside controllers). Is there a best practice for when and where to use these two? </p>