Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Javascript Getting Started with Programming
// A Codecademy Javascript (Fun with Functions) assignment
// Dr. Steven B. Combs, coding novice
// Constructor object notation
function Person(job, married) {
this.job = job;
this.married = married;
this.speak = function () { // Object with function (or method when a part of an object)
console.log ("Hello!");
};
}
var user = new Person("Codecademy Student",false);
user.speak(); // Calls the method in the object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.