Decimal and recalc function testing

An example of how we can configure decimal.js to automatically round to the correct number of decimal places when JSON.stringify()-ed.

by Aswin Devarajan

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/decimal.js/10.0.0/decimal.min.js"></script>
<pre id="output"></pre>

CSS

/* NaN:
  cess
  cgst
  itemValue
  marginAmount
  marginPer
  sgst
  taxableAmount
  total
  val

null:
  discRate
  inputUomName
  
undefined:
  quantity
  
Long decimal:
  rate
  salesRate
  unitPrice
  
  
   */

JavaScript

let viva = 2.222222222
let vida = Decimal.round(viva)
console.log(vida)