Guest User

Untitled

a guest
Dec 13th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. setCompensation() {
  2. // set these variables to string, to use toFixed(2)
  3. let value: string;
  4. let zero: string;
  5. if (isNaN(this.campaignModel.per_view_pay) || !this.compensateV) {
  6.  
  7. // since toFixed is converting to string, i am trying to parseFloat later.
  8. zero = (0).toFixed(2);
  9.  
  10. // removes the 0 at the end here
  11. this.campaignModel.viewer_gain = parseFloat(zero);
  12. } else {
  13.  
  14. // since toFixed is converting to string, i am trying to parseFloat later.
  15. value = (this.campaignModel.per_view_pay / 2).toFixed(2);
  16.  
  17. // removes the 0 at the end here
  18. this.campaignModel.viewer_gain = parseFloat(value);
  19. }
  20. }
  21.  
  22. var result = parseFloat(yourInput).toFixed(2);
Add Comment
Please, Sign In to add comment