function TheTable(calculateButtonId)
{
this.errorsBlock = document.getElementById("Some Value");
var addError = function(text) {
this.errorsBlock.innerText += text + "\n";
}
var customHandler = function(desc, page, line, chr) {
addError("[" + line + "] " + desc);
return true;
}
this.init = function() {
window.onerror = customHandler;
......................
}
this.init();
}
var table = new TheTable("BtnId");
as soon as I changed this.addError to var addError it started to thow an error:
Cannot set property 'innerText' of undefined
Could you clarify, what am I referencing by this inside of var-function?
addError?addErroris now local toTheTablebut you never call it there. You are leaving something out.thisat MDN. For "what am I referencing by this?" - it'sundefinedas your error message says