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

判断global对象,如果是window,就是运行在浏览器中,如果global对象是undefined,则运行在node中。

posted @ 2019-07-26 22:09  吴小明-  阅读(991)  评论(0编辑  收藏  举报