The mathjs library leaves the value in its original units when you toString()
. To simply convert or automatically, you need to make use the to
function or method like this
console.log(a.to('kgCO2eq').toString());
Reference: https://mathjs.org/docs/datatypes/units.html#usage