Advertisement
krot

Number toFixed

Jul 4th, 2017
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var num = new Number(123);
  2. var fix = num.toFixed();
  3. document.write(fix);
  4. document.write("<br/>");
  5.  
  6. num = new Number(123.456);
  7. fix = num.toFixed(5);
  8. document.write(fix);
  9.  
  10. // Output:
  11. // 123
  12. 123.45600
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement