I has been view some topic about Operator Not Working, but cannot solve my problem.
I have 2 JavaScript code.
<span id="number">this work</span>
<span id="miaonumber">this doesn't work</span>
<script>
setTimeout(start, 1000);
var hh = 9999.9999;
var num = document.getElementById('number');
function start() {
setInterval(increase, 1000);
}
function increase() {
if (hh > 0.0001) {
hh = (hh-0.0001).toFixed(15);
num.innerText = hh;
}
}
setTimeout(startmiao, 1000);
var zz = 8888.8888;
var nummiao = document.getElementById('miaonumber');
function startmiao() {
setInterval(increasemiao, 1000);
}
function increasemiao() {
if (zz > 0) {
zz = (zz+0.0001).toFixed(15);
nummiao.innerText = zz;
}
}
</script>
The <span id="number"></span>
will work, but the <span id="miaonumber"></span>
doesn't work, I open F12 to view, every second +1 error Uncaught TypeError: (zz + 0.0001).toFixed is not a function