扫码关注官方订阅号
我们有字符串输入数字 输入=“6145390195186705543” 如果我们想转换为数字;java脚本自动舍入此输入;
(6145390195186705543)
(6145390195186705000)
这应该适合您想要实现的目标
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)
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
这应该适合您想要实现的目标