This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.
Smartphone icons created by Freepik - Flaticon
All programming languages, including JavaScript, have difficulties with precise floating point values.
To solve the problem, it helps to multiply and divide:
let x = 0.1; let y = 0.2; let z = (x * 10 + y *10) / 10; document.getElementById("demo").innerHTML = z;