Skip to content

Commit 795fb29

Browse files
authored
toFixed
1 parent d9fb768 commit 795fb29

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@
4646
|40 | [pay attention when using every](#pay-attention-when-using-every)|
4747
|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)|
4848
|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)|
5150

5251

5352

@@ -924,4 +923,19 @@ const startSpeaking=()=>{
924923
}
925924
926925
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+
927941
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy