title: difference between setTimeout in javascript and $timeout service in angularjs
body: <p>Iam new to angular framework.Here is my scenario where, I want to change my $scope.variable after a period of time so i used javascript <code>setTimeout</code> method.</p>
  
  <pre><code>$scope.variable = 'Previous';
  
  setTimeout(function(){
    $scope.variable='NEXT';
  },3000);
  </code></pre>
  
  <p>This code doesn't work for me. I used <code>$apply()</code> to make this code work.</p>
  
  <p>Later I came to know that angular itself has a $timeout service which does the same work.</p>
  
  <pre><code>$scope.variable = 'Previous';
  
  $timeout(function () {
    $scope.variable = 'NEXT';
  }, 2000);
  </code></pre>
  
  <p>How can i compare performance of <code>$timeout</code> service with javascript <code>setTimeout</code>??</p>
  
  <p>Why we should use <code>$timeout</code> instead of <code>setTimeout</code>??</p>
  
  <p>Please give me some examples and reasons to use it, which shows the performance.</p>
  
  <p>Thanks :) </p>