Javascript decimal integer simple implementation
- 2020-03-30 03:09:06
- OfStack
JS:
Testing:
The browser prints out 12
function truncateNumber(n){
return n|0;
}
Testing:
console.log(truncateNumber(12.345));
The browser prints out 12