Learning about JS object construction