Help me grasp this please. I want to create object, which property "visible" and method "hi", but getting error on line 2:
TypeError: Cannot set property 'visible' of undefined
in:
var NewFilter = {};
NewFilter.prototype.visible = false;
NewFilter.hi = function () { console.info("hi"); }
OK I know that I have to actually create that object, but why the hell it's property throwing error when it should eventually do upon object creation?
visibleonprototype?.prototypeproperty, the constructor function that created the instance does. What prototype is and what it can be used for is explained here: stackoverflow.com/a/16063478/1641941