What is the best way to detect Node.JS/browser environment? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answer
0
I attach my script
7th Nov 2020, 2:20 AM
David Ordás
David Ordás - avatar