[javascript] In Javascript, how to conditionally add a member to an object?