Skip to content

Instantly share code, notes, and snippets.

View huangang's full-sized avatar
🎯
Focusing

章宦港 huangang

🎯
Focusing
View GitHub Profile
@huangang
huangang / uncaughtException.js
Last active July 31, 2019 00:54
nodejs 捕获未拦截的异常错误
process.on('uncaughtException', function (err) {
console.error('uncaughtException', err)
})
@huangang
huangang / strip.js
Created June 3, 2019 05:52
js 解决 0.28 * 100 = 28.000000000000004
/**
* 解决 0.28 * 100 = 28.000000000000004
* @param {*} num
* @param {*} precision
*/
function strip (num, precision = 12) {
return +parseFloat(num.toPrecision(precision))
}