早上看了个题目,不懂为什么会这样
//a.js
let counter = 10;
export default counter;
// index.js
import counter from "./a";
counter ++//这个是可以打印出11
counter+=1//error,counter is not defined
console.log(counter);
(下午17:00)补充下环境,用webpack起的dev-server服务:
webpack 4.41.2
nodejs v14.7.0
webpack-dev-server 3.9.0
我想问,这个counter不是只读的吗,你改变它的值没有报错吗