Why does
var spo = function(){
var qq = function(){};
}
throw the error undefined is not a function when
var spo = function(){
function qq(){};
}
does not?
More elaborate example throws the exact error: TypeError: undefined is not a function
node version v0.6.10 compiled on Ubuntu
spo = function(car){
var q = 10;
var s = 'fraggle';
var qq = function(){
console.log(s);
}
(function(){
while(q){
console.log(q);
q--;
}
qq.call();
car.call();
})();
};
spo(function(){console.log('as intended');});
In this
qqis assigned the function dynamically.On the other hand, in this case, qq is defined as a function which is visible everywhere in
spoEDIT:
In your updated code the actual problem is visible, no semi colon after function which results in a wrong statement like given below
Put a semi colon after function.