Function detectEnvironment
Returns Environment
The detected environment type
Example
const env = detectEnvironment()
if (env === 'browser') {
// Use browser-specific APIs
} else if (env === 'node') {
// Use Node.js-specific APIs
}See
isBrowser, isNode, isReactNative for specific checks
Detects the current JavaScript runtime environment
Performs comprehensive checks to identify whether the code is running in:
This is useful for conditional behavior based on platform capabilities.