- single number type, internally it's 64-bits floating point. (no separate integer type!)
- all characters are 16 bits wide. "A" === "\u0041"
- Variable is FUNCTION scope, instead of BLOCK scope. Use "var" to define a variable in a function, better at the top of function. Otherwise, the variable's scope will be global.
- The default value can be filled with default: var myVal = Data["src"] || "no-data" ;
- Objects are passed by reference. They are never copied.
- If the object lacks the property name, then JS attempts to get it from the prototype object. ==> hasOwnProperty()
- Removing a property from one object by using "delete" may allow a property from the prototype to shine through
- if ( typeof myVal !== 'function' ) ...
Function
- Function object are linked to Function.prototype and can have methods.
- Functions can be defined inside of other functions.
- Closure: the function object created by a function literal contains a link to that outer context.
- function foo( argA, argB, argC){...} foo("one", "two"); ==> argC will be undefined
- Be careful about the "this" variable.
- Function always returns a value, or undefined is returned instead.
- Closure usage !!!
- If methods return this, cascade calls can be enabled. getElement("id").moveUp().color('red').tip('abc');
- ...
TBC.....
No comments:
Post a Comment