When pushing an array\'s contents to another array I get
\"Uncaught TypeError: Cannot read property \'push\' of undefined\" error in this snippet.
In most cases you have to initialize the array,
let list: number[] = [];