This question is an exact duplicate:
- Function in function how to call 1 response
I read this article and can not understand why it does not work:
function test() { this.nameBRO = '123'; this.speedBRO = 555; } test.prototype.goodBRO = function(a) { this.str = a; console.log(this.str); }; Actually test.nameBRO can not call, writes Uncaught TypeError:
test.nameBRO is not a function The same speedBRO .
As for goodBRO : test.goodBRO('fd') - this is not called, only if you write test.prototype.goodBRO('fd') .
What am I doing wrong, then everything is just like 5 kopecks, why doesn't it work?
goodBRO : (new test()).goodBRO('fd'), onlygoodBROnothing to you - Igor