Possible duplicate of a similar question so sorry about that.
However, I can't seem to figure it out whether it is possible to print an integer with 0 value decimal. I have checked the https://javascript.info/number documentation still can't find an answer.
My attemps:
const sum = 1.0 + 1.0
const e = sum.toFixed(1)
console.log(e)
// string output "2.0"
const sum= 1.0 + 1.0
const e =+sum.toFixed(1)
console.log(e)
// integer output with no decimal 2
const sum= 1.0 + 1.0
const e = Number(sum.toFixed(1))
console.log(e)
// same integer output with no decimal 2
Is it possible to print an integer with a value of 2.0?