-1

this should be an easy one, but im stuck with the code i currently have!

enter image description here

   render: (value) => {
     return <span><b>{value}</b>%</span>;
   },

im trying to render the value, bold with the percentage sign as a suffix while rounding it down to only two digits after the decimal point :/

Dexygen
  • 12,287
  • 13
  • 80
  • 147
  • Does this answer your question? [Truncate (not round off) decimal numbers in javascript](https://stackoverflow.com/questions/4912788/truncate-not-round-off-decimal-numbers-in-javascript) – Dexygen Nov 25 '19 at 17:50

1 Answers1

1

You can use Number.prototype.toFixed()

return <span><b>{value.toFixed(2)}</b>%</span>;

Please Note: If value is string type then you have to convert that to number first:

return <span><b>{Number(value).toFixed(2)}</b>%</span>;
Mamun
  • 66,969
  • 9
  • 47
  • 59