title: How to create a method in object literal notation?
body: <p>I learned there are 2 types of creating objects. First: object literal notation and second: Object constructor. I have learned that there are also methods and functions, but I couldn't understand how to create a method in object literal notation? In object constructor I just write:</p>
  <pre><code>var bob = new Object();
  bob.age = 30;
  bob.setAge = function(newAge) {
    bob.age = newAge;
  };
  </code></pre>
  <p>Can you please tell me how to do the same when writing object literal notation.</p>
  <pre><code>var bob = {
    age: 30
  };
  </code></pre>