Skip to content

Instantly share code, notes, and snippets.

@themoxman
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themoxman/9418835 to your computer and use it in GitHub Desktop.
Save themoxman/9418835 to your computer and use it in GitHub Desktop.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment