I self-solved. 
Do people read this stuff??
Code:
<script type="text/javascript">
var holdMeOutside = []; // global variable holds function objects passed out
var example = function(a, b) {
var holdMeInside = []; // private variable holds objects passed within
function choose() { // inner function
for (i=0;i<5;i++)
{
var choice = prompt("enter a character from a-z"); // make this easier with a for loop reiteration up to 5 or less choices
// a return value of nothing will end the loop
if (choice.length >=0) { // do something looped
// holdMeOutside += holdMeOutside.push(choice); // this whole line failed, below line works
holdMeInside.push(choice); // add a value to the array
alert('array length:' + holdMeInside.length + 'params: ' + holdMeInside.toString());
}
}
// outside the FOR loop within the choose() function ... create new function
var constructIt = new Function([holdMeInside], 'alert("perform a function")'); // if array holds number, "unexpected number" exception thrown
alert(constructIt.toString());
alert(constructIt.length);
}
for (j=0; j<2; j++) {
if (example.length) { // the length property of the variable that holds the function should be 0 as only one thing is held.
// however if the function contains parameters, these will be counted in the length as well
// in this case, how do we make the parameters passable by reference
// can we build a prototype function which can add parameters on the fly?
console.log("That super-computed " + j + "nce");
}
else {
console.log("that didn't compute");
}
choose();
}
}
window.onload = example();
</script>
Bookmarks