我正在處理一個數值,如var number = 23.8981我需要檢查小數點后的第四個數字,并確定它是否是一個非0的數字。我不確定如何進行這種檢查。我是angularjs的新手,所以如果有任何關于這個特殊問題的幫助,我將非常感激。
uj5u.com熱心網友回復:
可以利用一些像下面這樣的javascript邏輯。
。const number = 23.8981;
const fourthDigit = number * 10000 % 10;
console.log(fourthDigit);
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" class="snippet-box-edit snippet-box-result" frameborder="0"></iframe>
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/306609.html
標籤:
上一篇:在d3.js中,是否可以將類的變化應用于selection.classed()的元素,或相對于其currentValue設定一個CSS屬性值?
