[arrays] use Array#slice to copy an array. Fixes #41

This commit is contained in:
Harrison Shoff
2013-01-13 20:29:38 -08:00
parent 4815ab0016
commit c30a067f10

View File

@@ -142,7 +142,7 @@
someStack.push('abracadabra');
```
- When you need to copy an array use Array() constructor. [jsPerf](http://jsperf.com/converting-arguments-to-an-array/7)
- When you need to copy an array use Array#slice. [jsPerf](http://jsperf.com/converting-arguments-to-an-array/7)
```javascript
var len = items.length,
@@ -155,7 +155,7 @@
}
// good
itemsCopy = Array.apply(null, items);
itemsCopy = Array.prototype.slice.call(items);
```
**[[⬆]](#TOC)**