I would like to set one array equal to another via a string. I have the following array:
var apartment234 = ["01.07.2017","02.07.2017","03.07.2017","04.07.2017","05.07.2017","06.07.2017","07.07.2017"];
And I have the following string which equals the array above (apartment234
).
unavailable = "apartment" + ausgewzimmer;
If I now want a function to return something based on the array as shown below, it doesn't return anything.
return !!(unavailable.indexOf(date.format('DD.MM.YYYY')) > -1);
However, if I use the array directly, it does work.
return !!(apartment234.indexOf(date.format('DD.MM.YYYY')) > -1);
//returns desired values
I am not sure what I am doing wrong... unavailable
does equal apartment234
as in unavailable = "apartment234"
. Why doesn't it function? Could you please help me?