" 如何判断当前脚本运行在浏览器还是 node 环境中?"

如何判断当前脚本运行在浏览器还是 node 环境中?

this === window ? 'browser' : 'node';
PS:写作不易,如要转裁,请标明转载出处。
登录
注册
回顶部