Home >Web Front-end >JS Tutorial >js decimal rounding function_basic knowledge
1. Discard the decimal part and keep the integer part
js:parseInt(7/2)
2. Round up, if there is a decimal, add 1 to the integer part
js: Math.ceil(7/2)
3, round down.
js: Math.round(7/2)
4, round down
js : Math.floor(7/2)