Loop over array and set all vars to false or true in javascript
- by Sixfoot Studio
Hi All,
I need to loop over my array and set all the vars to false or true. I have tried numerous options, none of which are working and it's clearly my lack of javascript syntax knowledge..Please take a look at this:
var closeAllCells = [IncomeOpen = "false",
RehabOpen = "false",
AttendantCareOpen = "false",
HomeMaintenanceOpen = "false",
DependantCareOpen = "false",
IndexationOpen = "false",
DeathFuneralOpen = "false",
ComprehensiveOpen = "false",
CollisionOpen = "false",
LiabilityOpen = "false",
DCPDOpen = "false"];
So my thinking is that I can just loop over this as follows
for (var i=0;i<closeAllCells.length;i++)
{
closeAllCells[i] = true; // or false if I wished
}