判断js运行环境是node还是浏览器 rongx 2021-12-19 1,342 阅读1分钟 typeof window !== 'undefined' ? console.log('前端') : console.log('后端')