0

In a Postman test script, I am trying to get a specific value using a simple calculation and return that value, in order to use it in a subsequent parts of the request.

let expectedDpay = temp.payPlanPremiumAmount;
let expectedDpay = (expectedDpay*12.5)/100;

The expected value I get is, for example 136.125 but I would like it to return to 2 decimal places, 136.13.

How can this be achieved?

Danny Dainton
  • 23,069
  • 6
  • 67
  • 80
Lilac
  • 580
  • 1
  • 7
  • 25

1 Answers1

1

Try num.toFixed(2) to round to 2 decimal places.

expectedDPay = ((expectedDPay * 12.5)/100).toFixed(2);
Frank Alvaro
  • 468
  • 4
  • 12