What is the best way to detect Node.JS/browser environment? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 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