|
46 | 46 | |40|[pay attention when using every](#pay-attention-when-using-every)|
|
47 | 47 | |41|[How to convert an array of key-value tuples into an object](#How-to-convert-an-array-of-key-value-tuples-into-an-object)|
|
48 | 48 | |42|[Native text to speech JS](#Native-text-to-speech-JS)|
|
49 |
| - |
50 |
| - |
| 49 | +|42|[Native text to speech JS](#Native-text-to-speech-JS)| |
51 | 50 |
|
52 | 51 |
|
53 | 52 |
|
@@ -924,4 +923,19 @@ const startSpeaking=()=>{
|
924 | 923 | }
|
925 | 924 |
|
926 | 925 |
|
| 926 | +``` |
| 927 | +
|
| 928 | +**[⬆ Back to Top](#table-of-contents)** |
| 929 | +### toFixed() |
| 930 | +
|
| 931 | +Warning: Floating point numbers cannot represent all decimals precisely in binary. This can lead to unexpected results, such as 0.1 + 0.2 === 0.3 returning false . |
| 932 | +
|
| 933 | +```javascript |
| 934 | +
|
| 935 | +123.678.toFixed() // Returns '124' |
| 936 | +123.678.toFixed(1) // Returns '123.7': Note rounding |
| 937 | +
|
| 938 | +2.35.toFixed(1) // Returns '2.4'. Note it rounds up |
| 939 | +2.65.toFixed(1) // Returns '2.6'. Note it rounds down -why??? see the warning above |
| 940 | +
|
927 | 941 | ```
|