今天,看“Javascript学习第一季(1)”时发现:

在javascript中,要把一个数转为二进制相当容易

<html>
<body>
<script>
 var i=12;
 alert(i.toString(2));
</script>
</body>
</html>

 

只要toString后面带一个参数即可。我以前还写了段子程序来转。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2021-09-04
  • 2021-06-12
  • 2021-10-15
  • 2022-01-31
猜你喜欢
  • 2022-12-23
  • 2021-05-24
  • 2021-11-02
  • 2021-12-04
  • 2021-11-22
  • 2022-12-23
  • 2021-12-04
相关资源
相似解决方案