javascript check if property exists in array of objects