Math rounding to decimals

How can I add a round to 2 decimal places function to this? I have tried several ways and formats and cannot get it to work properly.

function () {
return Number(document.childByName(“a”).content.text) / Number(document.childByName(“b”).content.text)
}

Anyone know how to make this work? Any help would be greatly appreciated.

If the value is a number:

function () {
   return ( Number(document.childByName("a").content.text) / Number(document.childByName("b").content.text) ).toFixed(2);
}

Thank you so much! I was putting the return by in the wrong location.


Back to Flipabit >
Copyright © 2018. Flipabit Team. All rights reserved.