javascript object creation and inheritance