Skip to content

Commit

Permalink
changing slice() to '...' for array copying
Browse files Browse the repository at this point in the history
  • Loading branch information
getify committed Jan 29, 2018
1 parent 6176963 commit 8a6578e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ch11-code/fp-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ function uncurry(fn) {

function zip(arr1,arr2) {
var zipped = [];
arr1 = arr1.slice();
arr2 = arr2.slice();
arr1 = [...arr1];
arr2 = [...arr2];

while (arr1.length > 0 && arr2.length > 0) {
zipped.push( [ arr1.shift(), arr2.shift() ] );
Expand Down

0 comments on commit 8a6578e

Please sign in to comment.