Check if the code is running in the browser
JavaScript
const isBrowser = typeof window === 'object' && typeof document === 'object'
TypeScript
const isBrowser: boolean = typeof window === 'object' && typeof document === 'object'
const isBrowser = typeof window === 'object' && typeof document === 'object'
const isBrowser: boolean = typeof window === 'object' && typeof document === 'object'