Note of <Javascript: The Definitive Guide>

3.6 Objects

Objects in js have the ability to serve as associative arrays.

image.width <==> image["width"]

3.9 Undefined

undefined is not a keyword in js.

null is actually a object.

var a = typeof null;  //return "object"

var k;

b =  typeof k; //return "undefined"

3.11 Automatic Data Type Conversion

*Conversions to Numbers

done = sum > "10"; // "10" will be converted to number 10

s = s - true; // true will be converted to 1

4.9 Operators

* The delete operator

delete is not the same as it is in C++.

delete a; <==> a = null;

* The void operator

the purpose of this operator is an unusual one: it always discards its operand value and simply return an undefined value.

The only occasion on which you are likely to do this is in a javascript: URL, which you want to evaluate an expression for its side effects, but do not want browser to display the value of the evaluated expression.

<a href="javascript:void document.form1.submit();">Submit</a>

7.4 Object Prototypes

* The properties of the prototype object for a class can be read through all objects of the class, although they appear to be, they are not actually the properties of these objects. When you read one of these properties of an object, you are reading the shared value from the prototype object. When you set the value of one of these properties for particular object, on the other hand, you are actually create a new property for that one object.

posted @ 2010-08-26 18:23  环宇者  阅读(139)  评论(0编辑  收藏  举报