JavaScript Simplified: JavaScript Simplified And Turned To Fun by Marcus O.A

JavaScript Simplified: JavaScript Simplified And Turned To Fun by Marcus O.A

Author:Marcus, O.A. [Marcus, O.A.]
Language: eng
Format: epub
Published: 2021-02-05T16:00:00+00:00


The above method will return 456 but this time its data type will be string.

Writing numbers up to a precision

Just like toFixed(), toPrecision() method also returns a rounded off number.

But it takes the total number of digits as the argument.

Suppose, we write toPrecision(3) so it will return a number which has exactly 3 digits.

Let’s see this in action.

The above method will return 34.6. And, myNum.toPrecision(5) will return 34.563.

Time to move to our next data type - Boolean .



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.