Create a gist now

Instantly share code, notes, and snippets.

Embed
var customer = {
firstName: "John",
lastName: "Doe",
greetCustomer: function(){
console.log("Hello again " + this.firstName + " " + this.lastName + "!");
},
calculateAge: function(currentYear, birthDate){
console.log(this.firstName + " is " + (currentYear - birthDate) + " years old.");
}
}
customer.calculateAge(2016, 1956); // Prints "John is 60 years old."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment