I'm just picking up Javascript, and I don't understand this problem.
I have created a custom object called DeleteReasonCodes
with an instance variable called delReasonCodes
, declared as an array. However, the inner methods can't seem to see this instance variable. Every time I try to run it, I get a delReasonCodes is not defined
error.
Perhaps I'm just not understanding the Javascript scoping rules?
var DeleteReasonCodes = {
delReasonCodes: [],
get: function ()
{
return delReasonCodes;
},
add: function (code, desc)
{
delReasonCodes.push(new DeleteReasonCode(code, desc));
}
};