运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,暗色/亮色
前往 Spaces
<!DOCTYPE html> <html> <body> <h2>Common JavaScript Mistakes</h2> <p>All programming languages, including JavaScript, have difficulties with precise floating point values.</p> <p>To solve the problem, it helps to multiply and divide:</p> <p id="demo"></p> <script> let x = 0.1; let y = 0.2; let z = (x * 10 + y *10) / 10; document.getElementById("demo").innerHTML = z; </script> </body> </html>