Defining objects in JavaScript