运行 ❯
获取您
自己
的网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Numbers</h1> <h2>The toLocaleString() Method</h2> <p>toLocaleString() returns a number as a string, using local language format.</p> <p>The options parameter (object) describes the formatting:</p> <p id="demo"></p> <script> let num = 1000000; const myObj = { style: "currency", currency: "EUR" } let text = num.toLocaleString("en-GB", myObj); document.getElementById("demo").innerHTML = text; </script> </body> </html>