Constructor functions begin w capital letter and should be preceded by 'new'. Use some_var = new SomeFunction();
to create objects inheriting from SomeFunction
.
An object in JS is a dynamic collection of properties.The three basic operations on an object are 'get' (object.name
), 'set' (object.name = some_value;
), and 'delete' (delete object.name
).
JS has prototypes, not classes. Make an object and then create objects that inherit from that object with 'object.create'.
Everything in js except null and undefined is an object.
Objects are passed by reference in js.
Functions can be values.
by convention, all variables, parameters, members, and function names start with lower case except constructor functions and global variables.
in js we have 'function statements' and 'function expressions'
in addition to variables and parameters, each function receives two pseudo parameters: 'arguments' and 'this'. the this
parameter (or pseudo-parameter) contains a reference to the object of invocation.