79587228

Date: 2025-04-22 18:37:42
Score: 0.5
Natty:
Report link
function roundSmart(value, decimals = 3) {
  return parseFloat(value.toFixed(decimals));
}

Use toFixed and you can give it a number of decimals you want to round to. It will cap at that many. If there are fewer then it wont matter.

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: David