-
-
Save nocodesupplyco/a7aed0f6efecf01bd049324e92e2c8b7 to your computer and use it in GitHub Desktop.
Round Number to Nearest Integer
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
// Round number to the nearest whole integer | |
var theNumber = 18510.01; | |
var roundedNumber = Math.round(theNumber); // will output 18500 | |
// Round number to the nearest thousand | |
var theNumber = 18510.01; | |
var roundedNumber = Math.round(theNumber/1000)*1000; //will output 19000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment