When pushing an array\'s contents to another array I get
\"Uncaught TypeError: Cannot read property \'push\' of undefined\" error in this snippet.
You do not need to give an index.
Instead of doing order[0].push(a[i]), just do order.push(a[i]).
order[0].push(a[i])
order.push(a[i])