Lodash _.round() Method
The _.round() method is used to compute number rounded to precision.
_.round(number, [precision = 0])
Parameters: This method accepts two parameters as mentioned above and described below:
- number: This parameter holds the number to round.
- [precision = 0]: This parameter holds the precision to round to.
Return Value: This method returns the rounded number.
Example 1: Here, const _ = require(‘lodash’) is used to import the lodash library into the file.