Math.round(x(x )四舍五入,例如math.round ) 0.70 )的结果为1; math.round(0.39 ),结果为0;
Math.floor(x(x )向下舍入,就像Math.floor(x ) 0.70 )和math.floor 0.39 )一样,结果都是0。
Math.ceil(x(x )向上舍入,结果均为1,如Math.ceil(x ) 0.70 )和math.ceil 0.39 )。
parseInt(x(x )舍弃小数部分,保留整数部分,而parseint (3.14 )则结果为3。
math.floor(:
_.each(cart_items,function(key ) var promotions _ barcode=promotions _ items [0].barcode s; if (promotions _ barcode.index of (key.barcode )!=-1 ) key.promotions _ count=math.floor (key.count/3 ); 取//3的整数倍,下取整数} else{ key.promotions_count=0; }; ); parseInt () :
函数获取结果(编号)返回分区(编号); } Math.ceil () :
函数getresult (num,n ) ) returnmath.ceil ); }