But we can also define a method as class member. This method wouldn't see "this", so could be used only to access class properties and methods.
To create a new class method we simply create it at class level, like this:
BlogEntry.showSignature = function() {
alert(BlogEntry.prototype.signature);
}
More information on custom objects in chapter ten of Head First JavaScript.
No comments:
Post a Comment