執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題,深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Number Methods</h1> <h2>The Number.parseInt() Method</h2> <p>Parse a string and returns the first integer:</p> <p id="demo"></p> <script> document.getElementById("demo").innerHTML = Number.parseInt("10", 10)+ "<br>" + Number.parseInt("010")+ "<br>" + Number.parseInt("10", 8)+ "<br>" + Number.parseInt("0x10")+ "<br>" + Number.parseInt("10", 16); </script> </body> </html>