|
148 | 148 | someStack.push('abracadabra');
|
149 | 149 | ```
|
150 | 150 |
|
151 |
| - - Quando devi copiare un array usa Array#slice. [jsPerf](http://jsperf.com/converting-arguments-to-an-array/7) |
| 151 | + - Quando devi copiare un array usa Array#slice. |
152 | 152 |
|
153 | 153 | ```javascript
|
154 | 154 | var len = oggetti.length;
|
|
195 | 195 | ```
|
196 | 196 |
|
197 | 197 | - Stringhe più lunghe di 80 caratteri devono essere scritte su più righe usando la concatenazione.
|
198 |
| - - Nota: Se usato troppo, stringhe lunghe con concatenazione possono intaccare la performance. [jsPerf](http://jsperf.com/ya-string-concat) e [Discussione](https://github.com/airbnb/javascript/issues/40). |
| 198 | + - Nota: Se usato troppo, stringhe lunghe con concatenazione possono intaccare la performance. [Discussione](https://github.com/airbnb/javascript/issues/40). |
199 | 199 |
|
200 | 200 | ```javascript
|
201 | 201 | // errato
|
|
213 | 213 | 'avere a che fare con questo, non arriverai da nessuna parte.';
|
214 | 214 | ```
|
215 | 215 |
|
216 |
| - - Quando devi costruire una stringa programmaticamente, usa Array#join invece della concatenazione. Soprattutto per IE: [jsPerf](http://jsperf.com/string-vs-array-concat/2). |
| 216 | + - Quando devi costruire una stringa programmaticamente, usa Array#join invece della concatenazione. |
217 | 217 |
|
218 | 218 | ```javascript
|
219 | 219 | var oggetti;
|
|
1083 | 1083 | var val = parseInt(inputValue, 10);
|
1084 | 1084 | ```
|
1085 | 1085 |
|
1086 |
| - - Se per qualsiasi ragione stai facendo qualcosa di strano e `parseInt` è il tuo collo di bottiglia allora devi usare Bitshift per [motivi di performance](http://jsperf.com/coercion-vs-casting/3), lascia un commento spiegando come mai e cosa stai facendo. |
| 1086 | + - Se per qualsiasi ragione stai facendo qualcosa di strano e `parseInt` è il tuo collo di bottiglia allora devi usare Bitshift per motivi di performance, lascia un commento spiegando come mai e cosa stai facendo. |
1087 | 1087 |
|
1088 | 1088 | ```javascript
|
1089 | 1089 | // corretto
|
|
1496 | 1496 | }
|
1497 | 1497 | ```
|
1498 | 1498 |
|
1499 |
| - - Per query del DOM usa a cascata `$('.sidebar ul')` o parent > child `$('.sidebar > ul')`. [jsPerf](http://jsperf.com/jquery-find-vs-context-sel/16) |
| 1499 | + - Per query del DOM usa a cascata `$('.sidebar ul')` o parent > child `$('.sidebar > ul')`. |
1500 | 1500 | - Usa `find` con scoped query di oggetti jQuery.
|
1501 | 1501 |
|
1502 | 1502 | ```javascript
|
|
1542 | 1542 | ## Performance
|
1543 | 1543 |
|
1544 | 1544 | - [On Layout & Web Performance](http://kellegous.com/j/2013/01/26/layout-performance/)
|
1545 |
| - - [String vs Array Concat](http://jsperf.com/string-vs-array-concat/2) |
1546 |
| - - [Try/Catch Cost In a Loop](http://jsperf.com/try-catch-in-loop-cost) |
1547 |
| - - [Bang Function](http://jsperf.com/bang-function) |
1548 |
| - - [jQuery Find vs Context, Selector](http://jsperf.com/jquery-find-vs-context-sel/13) |
1549 |
| - - [innerHTML vs textContent for script text](http://jsperf.com/innerhtml-vs-textcontent-for-script-text) |
1550 |
| - - [Long String Concatenation](http://jsperf.com/ya-string-concat) |
1551 | 1545 | - Caricamento...
|
1552 | 1546 |
|
1553 | 1547 | **[⬆ torna in cima](#tavola-dei-contenuti)**
|
|
0 commit comments