v and it will return either:
vis one or more cents/pennies/whatever away from a round dollar/pound/whatever: a String that is
vrounded to 2 decimal places.
vas a Number rounded to the nearest dollar/pound/whatever.
So, for example:
The function can therefore return either a Number or a String. I didn’t add a line to convert a return Number to a String because it was completely unnecessary for my purposes, but it would be easy enough by changing line 5 to
integer + "";
It goes without saying but use as you wish!