I have a function that has a couple of for statements in it. I need to be able to pass code to the for statements via parameters.
var a = function(paramCode){
for(var eachRow=0; eachRow<20; eachRow++){
for(var eachCol=0; eachCol<20; eachCol++){
paramCode
}
}
}
a({ //the code I want to pass is surrounded in the function pointers
if(array[x][y]){
//do something
}
});
This is a basic version of what I'm trying to do. The only problem is the error I get in the console.
Uncaught SyntaxError: Unexpected token [
I would love to know how to fix this error, or a way that I can still do what I'm trying to do.