[javascript] How to check if object property exists with a variable holding the property name?