Notes on JavaScript Syntax

by nex on 4/11/05 3:49 AM in

Short code snippets for reference purposes. To be expanded later.


Constructor:
function Foo(value) {
<!--av-code-->this.setValue(value);
}

Constructing an object:
var bar = new Foo(value);

Method definition:
Foo.prototype[methodName] = function;

Inheritance (not quite):
Subclass.prototype = new Superclass();

Check this out:
prototype.constructor
call/apply
arguments
OMFG(functions)(may)(return)(functions)



 |