DEV Community

Discussion on: My Favorite JavaScript Tips and Tricks

Collapse
 
jankapunkt profile image
Jan Küster • Edited

Note, that the Number rounding of floats in JavaScript is not accurate

(0.1 + 0.2) === 0.3 // false

Since this rounding affects integer representation, too, you should also consider Number.isSafeInteger

developer.mozilla.org/en-US/docs/W...

Also please consider Integer boundaries in JS, that are represented by Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER

developer.mozilla.org/en-US/docs/W...

developer.mozilla.org/en-US/docs/W...

Edit: sry wanted to post on top level, somehow ended up as comment on yours

Collapse
 
atapas profile image
Tapas Adhikary

Awesome, thanks Jan!