No, that will not work. What matters is where the (lexically) function is defined , and not where it is called.
When determining what (if something) means "c", the language looks in the local area, and then in the next area based on the definition of the function. Thus, if this call to "a" took place in another function that had its own local "c", then this value would be what the warning showed.
function b() { var c = 'banana'; a(function() { alert(c); }); } b();
source share