Object Literals
好久没有写东西了。
对象字面量:
var car = {myCar:"Saturn",getCar:CarTypes("Honda"),special:Sales};
alert(car.myCar) //output Saturn
var car = { manyCars: {a: "Saab", "b": "Jeep"}, 7: "Mazda" };
document.write(car.manyCars.b); // Jeep
document.write(car[7]); // Mazda
var foo = {a: "alpha", 2: "two"};
document.write(foo.a); // alpha
document.write(foo[2]); // two
//document.write(foo.2); // Error: missing ) after argument list
//document.write(foo[a]); // Error: a is not defined
document.write(foo["a"]); // alpha
document.write(foo["2"]); // two