How to check if a JavaScript object property is undefined