Javascript 取模运算、取商、取整方法

@yangweijie 2017-07-10 23:44:40发表于 yangweijie/note blogjavascript

//求余数  
document.write(1%4);  
document.write(6%4);  
//求商  
console.info(1/4);  
console.info(6/4);  
//求商,取整  
console.info(parseInt(1/4));  
console.info(parseInt(6/4));  
console.info('----');  
//天花板取整  
console.info(Math.ceil(1/4));  
//地板取整  
console.info(Math.floor(1/4));