mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-14 02:28:20 -05:00
[type casting] move explanation about bitshift closer to example code. fixes #80
This commit is contained in:
@@ -914,7 +914,6 @@
|
||||
```
|
||||
|
||||
- Use `parseInt` for Numbers and always with a radix for type casting.
|
||||
- If for whatever reason you are doing something wild and `parseInt` is your bottleneck and need to use Bitshift for [performance reasons](http://jsperf.com/coercion-vs-casting/3), leave a comment explaining why and what you're doing.
|
||||
|
||||
```javascript
|
||||
var inputValue = '4';
|
||||
@@ -936,6 +935,9 @@
|
||||
|
||||
// good
|
||||
var val = parseInt(inputValue, 10);
|
||||
```
|
||||
|
||||
- If for whatever reason you are doing something wild and `parseInt` is your bottleneck and need to use Bitshift for [performance reasons](http://jsperf.com/coercion-vs-casting/3), leave a comment explaining why and what you're doing.
|
||||
|
||||
// good
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user