Last active
January 17, 2019 06:15
-
-
Save if540/4d76790e8a6b859148f8cae4e524c70a to your computer and use it in GitHub Desktop.
去小數點 ( Math.floor 向下取值 )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toPointFixed(value, position) { | |
const decimalType = 10; | |
let decimalNumber = Math.pow(decimalType, position) | |
return Math.floor(value * decimalNumber) / decimalNumber | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment