Skip to content

Instantly share code, notes, and snippets.

@stevencombs
Created September 21, 2013 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevencombs/6652905 to your computer and use it in GitHub Desktop.
Save stevencombs/6652905 to your computer and use it in GitHub Desktop.
// Javascript Getting Started with Programming
// A Codecademy Javascript (Make Your Own Method) assignment
// Dr. Steven B. Combs, coding novice
var setAge = function (newAge) { // New function
this.age = newAge; // Use this as a method placeholder for the function
};
var bob = new Object(); // New object 'bob'
bob.age = 30; // Set 'bob' age
bob.setAge = setAge; // Use method to modify age
var susan = new Object(); // New object 'susan'
susan.age = 25; // Set 'susan' age
susan.setAge = setAge; // Use method to modify agge
susan.setAge (35); // Use function/method to modify 'susan' age
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment