You can use sap.ui.getCore().AppContext(ui5 provided as global variables) instead of window.
Application data between different views
sap.ui.getCore().AppContext.Array = your list of values.
i tried,
sap.ui.getCore().AppContext=new Object();
sap.ui.getCore().AppContext.Array = ['dsfdsf','2gereh','3dsfd'];
console.log(sap.ui.getCore().AppContext.Array);
console.log(sap.ui.getCore().AppContext.Array.length);
console.log(sap.ui.getCore().AppContext.Array[0]);
my console is showing,
["dsfdsf", "2gereh", "3dsfd"]
3
dsfdsf
so you can loop it as below,
for(var i=0;i< sap.ui.getCore().AppContext.Array.length;i++)
alert( sap.ui.getCore().AppContext.Array[i]);