<script>
var num = 3;
var num1 = 3.33;
/*
toString()方法可以根据所传递的参数把数值转换为对应进制的数字字符串。参数范围为 2~36 之间的任意整数。
toFixed(2)方法可以把Number 四舍五入为指定小数位数的数字
*/
console.log(num.toString(2));
console.log(num.toFixed(2));
console.log(num1.toFixed(4));
</script>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
  • 2021-11-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-11
  • 2022-12-23
  • 2021-09-25
  • 2021-06-08
  • 2022-01-24
  • 2021-08-09
相关资源
相似解决方案