Take a look at the following code
//btns is an array passed as a parameter to a function
for(var i = 0, b; b = btns[i]; i++) {
b.handler = function () {
var a = btns[i].some_field; //undefined
//the same for "b.some_field;"
};
}
Why btns[i]
is undefined?
PS. the code adds click handler on extjs buttons if that matters.