1. a few concepts to remember
- Expression: Something which evaluates to a value. Example: 1+2/x (to be executed, return a value).
- Statement: A line of code which does something. Example: GOTO 100
- Function delcaration : function Identifier ( FormalParameterList opt ){ FunctionBody }
- Function expression : function Identifier opt ( FormalParameterList opt ){ FunctionBody }
try to understand their position and relationship in javascript is quite important.
Ref: http://stackoverflow.com/questions/19132/expression-versus-statement
Ref: http://yura.thinkweb2.com/named-function-expressions/
2. Object.constructor will return who object declaration. e.g. [].constructor = function Array(){}
3. object.constructor.name will display the name of the object.
e.g. [].constructor.name == Array
4. another good article: http://jibbering.com/faq/faq_notes/closures.html
5. *Never no that until now* if you were to declare saying without the var keyword preceding it, it would automatically become a global variable
ref: http://robertnyman.com/2008/10/09/explaining-javascript-scope-and-closures/
6. understand javascript closure , prototype property of an object is important to understand OO JS.
Here is a nice graphic for OO JS, I copied from another guy in Javaeye.
Ref: http://www.iteye.com/wiki/Object_Oriented_JavaScript/1317-javascript-object-oriented-technology-