Which method would you use to determine if the user's browser supports a specific Web API?
Feature detection is done by checking if the API exists in its expected location: 1) The proper feature detection pattern is to check if an API property or method exists on its parent object, 2) For example, to check for geolocation support: if ('geolocation' in navigator), 3) This is more reliable than browser detection via user agent strings, 4) It directly tests for the feature you want to use rather than inferring support, 5) This approach works across browsers and versions without requiring constant updates, 6) For methods, sometimes it's necessary to check typeof obj.method === 'function', 7) This pattern is fundamental to progressive enhancement and graceful degradation strategies, 8) For more complex APIs, you might need to check multiple properties to ensure full support.