I'm using Javascript within the programming environment of Max/MSP. Here's a basic overview of it's implementation in Max if you're interested. There's nothing particularly unusual there. Just some custom functions/methods available.
So I'm not entirely sure of my terminology here. I have this: var velData = MultiDimensionalArray(8, 16)
declared globally, which is referred to in the function below.
Is it a global variable? Since it's calling a function, MultiDimensionalArray
, does that make velData
a function expression? Either way, I'm unable to access a variable from outside my function:
function list(y) {
if (inlet == 1) {
y = arrayfromargs(messagename,arguments);
for (var i = 0; i < y.length; i++ ) {
velData[row][i] = y;
}
}
}
post(velData[0][0]);
post();
post()
is the equivalent to console.log and post(velData[0][0])
works when it's inside the function but not outside of it. I thought that since velData
is declared globally, I should be able to access it outside the function but I can't.
Here is the code on Jsfiddle - http://jsfiddle.net/estevancarlos/WHc5j/
Suggestions?