* { margin:0; padding:0; } div { margin:0 auto; width:400px; } div>h4 { padding:10px 0; text-align:center; color:rgb(255,0,255); } ul { list-style:none; color:#424242; } ul::before { display:block; padding:8px 10px; background-color:skyblue; } ul#calcFloat::before { content:"calcFloat(n)"; } ul#toFixed::before { content:"toFixed(n)"; } ul>li { padding:8px 10px; font-size:14px; font-weight:400; } ul#calcFloat { float:left; } ul#toFixed { float:right; } ul#calcFloat>li { background-color:#ccc; } ul#toFixed>li { background-color:#F9FBE7; }
更新时间:2019-11-08 01:32:11
说明:1、calcfloat的参数num的指定区间为[0,100],否则返回"请将保留小数位控制在1-100之间"(默认num为0);
2、取小数位时,遵循四舍五入规定;