How make code rounding of value 2.46666666666 to 2.47 ? 🙏 | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

How make code rounding of value 2.46666666666 to 2.47 ? 🙏

16th Jul 2022, 1:04 PM
Zulpakar
Zulpakar - avatar
3 Antworten
+ 5
You can use the toFixed() method console.log((1/3).toFixed(2)) If you want to find it out yourself and not having to wait for others' responses, consider googling "Javascript round to 2 decimals" or something like that
16th Jul 2022, 1:20 PM
Lisa
Lisa - avatar
+ 4
var n = 2.4666666666 console.log(n.toFixed(2)) //2.47
16th Jul 2022, 1:18 PM
SomeAwesome
SomeAwesome - avatar
0
Thanks for help me Lisa & SomeAwesome good solutions 👌
16th Jul 2022, 5:42 PM
Zulpakar
Zulpakar - avatar