title: What is the difference between Methods and Functions? How to declare a method?
body: <p>I am learning Javascript on Codecademy. As my understanding Method is a function associated with the objects. I think to call it a method it should inside an object. Is it? Should I really fully understand main difference between functions and methods to write error free code. This is very confusing to me.</p>
  
  <p>Below it the Codecademy code, they say on line 2 'setAge' is a Method where it is clearly looks like a function. It is not even related to any Object yet. Coz it is not even inside of any object.</p>
  
  <pre><code>// here we define our method using "this", before we even introduce bob
  var setAge = function (newAge) {
    this.age = newAge;
  };
  
  // now we make bob
  var bob = new Object();
  bob.age = 30;
  bob.setAge = setAge;
  
  // make susan here, and first give her an age of 25
  var susan = new Object();
  susan.age = 25;
  susan.setAge = setAge;
  susan.setAge(35);
  // here, update Susan's age to 35 using the method
  </code></pre>