如何在javaScript中將字串轉換為19位數字而不自動舍入?
P粉652495194
P粉652495194 2024-03-30 14:42:35
0
1
375

我們有字串輸入數字 輸入=“6145390195186705543” 如果我們想轉換為數字;java腳本自動舍入此輸入;

(6145390195186705543)

(6145390195186705000)

P粉652495194
P粉652495194

全部回覆(1)
P粉025632437

這應該適合您想要實現的目標

const myFunction = (num) => {

const length = num.length;

const result = `(${num.slice(0,16).padEnd(length, "0")})`;
return result;
};

const input="6145390195186705543";
const output = myFunction(input); 
console.log(output)
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!