运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <body> <h2>JavaScript Numbers</h2> <p>The toString() method can output numbers from base 2 to 36:</p> <p id="demo"></p> <script> let myNumber = 32; document.getElementById("demo").innerHTML = "Decimal 32 = " + "<br><br>" + "Hexatrigesimal (base 36): " + myNumber.toString(36) + "<br>" + "Duotrigesimal (base 32): " + myNumber.toString(32) + "<br>" + "Hexadecimal (base 16): " + myNumber.toString(16) + "<br>" + "Duodecimal (base 12): " + myNumber.toString(12) + "<br>" + "Decimal (base 10): " + myNumber.toString(10) + "<br>" + "Octal (base 8): " + myNumber.toString(8) + "<br>" + "Binary (base 2): " + myNumber.toString(2); </script> </body> </html>