title: how to convert numbers to million in javascript
body: <p>As in image. for some values converting correctly but some of values not converting... you can see in image</p>
  
  <p>I want to convert numbers to million.I am using Money format function to convert numbers but i am unable to convert numbers.</p>
  
  <p>This is controller part.for some numbers it is converting to millions and for some numbers it is not converting.. Please someone help.</p>
  
  <pre><code> $scope.MoneyFormat = function (labelValue) 
                      {
                            // Nine Zeroes for Billions
                            return Math.abs(Number(labelValue)) &gt;= 1.0e+9
  
                                 ? Math.abs(Number(labelValue)) / 1.0e+9 + "B"
                                 // Six Zeroes for Millions 
                                 : Math.abs(Number(labelValue)) &gt;= 1.0e+6
  
                                 ? Math.abs(Number(labelValue)) / 1.0e+6 + "M"
                                 // Three Zeroes for Thousands
                                 : Math.abs(Number(labelValue)) &gt;= 1.0e+3
  
                                 ? Math.abs(Number(labelValue)) / 1.0e+3 + "K"
  
                                 : Math.abs(Number(labelValue));
                     }
  </code></pre>
  
  <p>Here I am converting numbers by using Moneyformat. This is controller part where I am converting numbers</p>
  
  <pre><code>            $scope.rep.won = $scope.MoneyFormat($scope.rep.won);
              $scope.outlook.rem = $scope.MoneyFormat($scope.outlook.rem);
              $scope.rep.expectedAmount = $scope.MoneyFormat($scope.rep.expectedAmount);
              $scope.rep.potential = $scope.MoneyFormat($scope.rep.potential);
              $scope.rep.quota = $scope.MoneyFormat($scope.rep.quota);
  </code></pre>