+ 2

What is the best way to detect Node.JS/browser environment?

I know these: BROWSER: (typeof window !== "undefined") BACKEND/NODE: (typeof module.?exports !== "undefined") && (typeof process !== "undefined") Are valid? https://code.sololearn.com/cxVqYZ7L9su9/

7th Nov 2020, 1:29 AM
David Ordás
David Ordás - avatar
1 Réponse
0
I attach my script
7th Nov 2020, 2:20 AM
David Ordás
David Ordás - avatar