JavaScript methods: method, uber and inherits?

R

relaxedrob

Howdy All!

I was reading this page:
http://www.crockford.com/javascript/inheritance.html

And it has some code examples:

function Parenizor(value) {
this.setValue(value);
}
Parenizor.method('setValue', function (value) {
this.value = value;
return this;
});
Parenizor.method('getValue', function () {
return this.value;
});
Parenizor.method('toString', function () {
return '(' + this.getValue() + ')';
});


Is this code ok? I am getting errors saying:
Error: Parenizor.method is not a function

And then there are some other examples:

function ZParenizor(value) {
this.setValue(value);
}
ZParenizor.inherits(Parenizor);
ZParenizor.method('toString', function () {
if (this.getValue()) {
return this.uber('toString');
}
return "-0-";
});


I have been checking the ECMAScript spec's .. and there are no
mentions of methods called 'uber' or 'inherits' ...

What am I missing here?

Thanks for any advice!

Rob
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top