Hey Guys! What does the .toFixed() and toString() do and its use? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hey Guys! What does the .toFixed() and toString() do and its use?

Thanks Guys!

29th Jun 2017, 11:05 AM
Teddy Pascual
Teddy Pascual - avatar
2 Answers
+ 2
Taken from https://cheeze.club/bhfw var numObj = 12345.6789; numObj.toFixed(1); // Returns '12345.7': note rounding numObj.toFixed(6); // Returns '12345.678900': note added zeros Read more on .toString() here https://cheeze.club/ds4l Every object has a toString() method that is automatically called when the object is to be represented as a text value or when an object is referred to in a manner in which a string is expected.
29th Jun 2017, 11:12 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
0
Thanks a Lot!
29th Jun 2017, 11:16 AM
Teddy Pascual
Teddy Pascual - avatar