JavaScript: factory function ~> Object