Here is very simple code to round up the decimal as below:
var cost = 5.2382565
var roundCost = cost.toFixed(2)
// Here you will get the output: 5.24
You change the toFixed value as per you need instead of 2.
I hope it will resolve your problem if you have any other issue please let me know.