====== Objects ====== * objects are created with the "new" keyword * constructors for objects are simply functions * the "this" keyword indicates the current instance of the object * property variables can be defined within the function, but are not required to be, and can be added at any time ===== Creating an object ===== ===== using Object() ===== var dog = new Object(); dog.name = "fido"; dog.weight = 50; dog.color = "Brown"; ===== using a constructor ===== function animal(){ } var dog = new animal(); ===== using a constructor with arguments ===== function animal(name, weight, color){ this.name = name; this.weight = weight; this.color = color; } var dog = new animal("fido", 50, "Brown"); ===== using shortcut brackets ===== var dog = {name:"fido", weight:50, color:"Brown}; ===== See Also ===== * [[copy prototype]]