mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-13 21:48:05 -05:00
Clarify proper type casting for Numbers
Clarifies when to use `Number` vs. `parseInt` for Number type casting. Fixes: #523
This commit is contained in:
@@ -1640,7 +1640,7 @@ Other Style Guides
|
||||
const totalScore = String(this.reviewScore);
|
||||
```
|
||||
|
||||
- [21.3](#21.3) <a name='21.3'></a> Use `parseInt` for Numbers and always with a radix for type casting.
|
||||
- [21.3](#21.3) <a name='21.3'></a> Numbers: Use `Number` for type casting and `parseInt` always with a radix for parsing strings.
|
||||
|
||||
```javascript
|
||||
const inputValue = '4';
|
||||
|
||||
Reference in New Issue
Block a user