Example object oriented programming in JavaScript