0
0

More than 1 year has passed since last update.

JavaScriptで小数点以下の桁数を指定する方法

Last updated at Posted at 2019-07-03

JavaScriptで小数点以下の桁数を指定する方法

Number.prototype.toFixed()を使います。
以下が例です。
Screen Shot 2019-07-03 at 23.39.12.png

指定桁数になるように、0の右埋めをしてくれるので便利です。
この記事が参考になれば幸いです。
公式: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed

終わりに

私は現在、Web3のサービスの開発をしています。詳しくはこちらの記事をご覧下さい。
無料でイーサリアムが当たる、Web3時代の寄付サイトを作った話

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0