module 直接调用const显示undefine

来源:3-1 环境 & 调试 ——CommonJS1

慕慕7001127

2019-09-17

file里面有这两句话的时候,执行结果是undefine.
为什呢?

#01_run.js
const tst = 'test';
console.log(module.tst);
写回答

2回答

Samaritan

2019-11-08

内部用的就是本地变量了

0
0

qq_乐乐乐_1

2019-10-09

你打印一下module,,,console.log(module);
,你会知道为什么。

0
0

Node.js入门到企业Web开发中的应用

Node.js是Web应用开发的一个福音,特别适合中小型系统的快速开发!

1580 学习 · 303 问题

查看课程