笔记

1. 四舍五入

  Math.floor:对数进行下舍入。

    Math.ceil:对数进行上舍入。Math.ceil(0.60)==1 ;Math.ceil(0.40)==1;Math.ceil(5.1)==6;Math.ceil(-5.1)==-5;

    NumberObject.toFixed(num):方法可把 NumberObject四舍五入为指定小数位数的数字。new Number(13.37).toFixed(1)==13.4;

2.数组清空

   var arr=[12,13,13];

   清空方式一:arr.length=0;

                 二: arr=[];

原文地址:https://www.cnblogs.com/benhua/p/9241779.html