var num1 = 123.4567
console.log(num1.toFixed())
My Ans is = 123
but quiz Ans is = “123”
Kindly Explain me how its come as “123”
var num1 = 123.4567
console.log(num1.toFixed())
My Ans is = 123
but quiz Ans is = “123”
Kindly Explain me how its come as “123”
H @uanis933 ,
The toFixed() method converts a number to a string . The toFixed() method rounds the string to a specified number of decimals.
`var num1 = 123.4567 console.log(num1.toFixed()) // It will show the result as 123, but actually it is a string.
so that the correct answer is “123.”