Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我划分两个不同的变量时,我得到了这个返回:
1.4007342235591407
但我想要的只是两位小数,如下所示:
1.40
这是我的代码:
document.getElementById('place').innerHTML = meter / seler;
使用<number>.toFixed(2).
<number>.toFixed(2)
document.getElementById('place').innerHTML = (meter / seler).toFixed(2);