var sagas = [];
var newfunction = function () {
var saga = 'hello';
sagas.push(function () {
var deed = 'nice man';
console.log(saga);
});
};
newfunction();
sagas[0]();
when we run sagas[0]()
it prints hello it should print undefined as per function scoping ? I tried to think why it prints hello but couldn't