Javascript errors in function zip()