Determines whether the current environment is a browser.
Checks for the existence of window and document objects to infer a browser context.
window
document
true if running in a browser environment, otherwise false.
true
false
isBrowser(); // true in browser, false in Node.js or other non-browser environments Copy
isBrowser(); // true in browser, false in Node.js or other non-browser environments
Determines whether the current environment is a browser.
Checks for the existence of
windowanddocumentobjects to infer a browser context.