[javascript] How to check if a value exists in an object using JavaScript