Pages

Wednesday, October 6, 2010

OOP Javascript (Hints)

Hints
  • Use Visual studio 2010, for writing all the code, it support intellisense
  • Use /// , inside the Javascript file to reference other just to support intellisense
  • when you define function as class, like
    var Dog = function (id, name, age, color) {
    this.Color = color;
    this.Age = age;
    this.ID = id;} //you cannot use Dog.Color [Wrong]

    you have to initiate the object first like

    var buddy = new Dog(1, 'Buddy', 3, 'White');
    then you will call buddy.Color.

No comments:

Post a Comment