如何解决NaN值而不是隐藏字符串

时间:2019-07-16 16:28:26

标签: javascript

我以秒为单位计算网络余额,如果我将值设置为6位数字,则有效,如果超过百万,则为NAN。

我尝试过fixtoto(8),100

 <h3><font id="minedAmount">0</font></h3>
                                            </div>
daily =4,023.56991953/my expected calculated value

    <script>
    $(document).ready(function(){  
        let daily = $('#dailyAmount').text();
        let inMili = daily/864000;
        let incVal = {{isset($balance) ? $balance : 0}};
        setInterval(function(){ 
            incVal = incVal+inMili;
            $('#minedAmount').text(incVal.toFixed(8)); 
        },100);
    });
</script>

1 个答案:

答案 0 :(得分:1)

您可以将每日数字转换为数字-

let daily = parseInt($('#dailyAmount').text());

或,let daily = parseFloat($('#dailyAmount').text());