Guest User

Untitled

a guest
Jul 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. var total = 10.90;
  2.  
  3. totalreal = parseInt(total)
  4. totalrealF = parseFloat(total)
  5. totalrealN = Number(total)
  6.  
  7. document.write(
  8.  
  9. 'R$ ' + totalreal + '<br>' +
  10. 'R$ ' + totalrealF + '<br>' +
  11. 'R$ ' + totalrealN + '<br>' +
  12. 'R$ ' + total + '<br>'
  13.  
  14. );
  15.  
  16. R$ 10
  17. R$ 10.9
  18. R$ 10.9
  19. R$ 10.9
  20.  
  21. R$ 10.90
  22.  
  23. var total = 10.90;
  24.  
  25.  
  26. totalrealF = parseFloat(total).toPrecision(4)
  27.  
  28.  
  29. console.log(totalrealF)
Add Comment
Please, Sign In to add comment