JS——小数转换成百分比
7/10/2022
文章链接:https://blog.csdn.net/qq_43201350/article/details/109178424
用法
toFixed() 方法可把 Number 四舍五入为指定小数位数的数字。 NumberObject.toFixed(num) num: 规定小数的位数,是 0 ~ 20 之间的值,包括 0 和 20。
(0.88).toFixed(2)*100+'%' //88%文章链接:https://blog.csdn.net/qq_43201350/article/details/109178424
toFixed() 方法可把 Number 四舍五入为指定小数位数的数字。 NumberObject.toFixed(num) num: 规定小数的位数,是 0 ~ 20 之间的值,包括 0 和 20。
(0.88).toFixed(2)*100+'%' //88%