var arr = function()
{
alert(arr['testB']);
}
arr['testA'] = true;
arr['testB'] = false;
arr['testC'] = true;
arr[arr[0]] = arr;
document.write(arr[arr[0]]);
document.write("<br/>");
document.write(arr['testC']);
document.write("<br/>");
document.write(arr[0]);
document.write("<br/>");
arr[arr[0]]();
document.write("<br/>");
document.write("foreach...<br/>");
for (var i in arr)
{
document.write(arr[i]);
document.write("<br/>");
}
This is not only viable syntax, but this code will run and output values consistent with the index resolution of the array (when it is an array and not a function, that is). Interestingly, it appears to be a valid strategy to have an undefined value as a key in a key value pair. My favorite aspect of this is declaring a function, array and key/value list as a single variable and have it act accordingly depending on how you reference it. Even when you make one of the values within the key/value array the array itself.
Go home Javascript, you are drunk.