Free Tarot Readings

JavaScript JS : Fill a multidimensional array of any size easily with a single value


function FillArray(theArray , theValue)
{
var arrayLength = theArray.length;
for(var I = 0 ; I < arrayLength; I++)
{
if ( !(theArray[I] instanceof Array) )
{//at the end on this array of array, so set the value and return
theArray[I] = theValue;
}
else
{//recurse through array of arrays
FillArray(theArray[I] , theValue);
}
}
}