CourtneyJordan
6/1/2015 - 7:26 PM

Object Methods

Object Methods

###Object Methods

Javascript MEthods are the actions that can be preformed on objects. In short it's a proprrty containing a function definition.

Private Methods

Methods can be private within a class and inaccessible outside of a class. This is usually done for security reasons.

Example Private

function Person(fname,lname,age){
  this.fname = first;
  this.lname = last;
  this.age = age; 
  var bankBalance = 5000; //Using a varible makes the property private.
}

Example Access Granted

    function Person(fname,lname,age){
      this.fname = first;
      this.lname = last;
      this.age = age; 
      this.bankBalance = 5000; //Using this makes the property accessible.
    }