This snippet shows you how to round a number to a specified number of decimal places in JavaScript.
Source code viewer
var number = 100.994; number.toFixed(); // Returns "100" number.toFixed(2); // Returns "100.99"Programming Language: Javascript