GitHub 6521★

Check if the code is running in the browser

JavaScript version

const isBrowser = typeof window === 'object' && typeof document === 'object';

TypeScript version

const isBrowser: boolean = typeof window === 'object' && typeof document === 'object';
Follow me on and to get more useful contents.