定义一个数组，调用方法报错
通过不同方式定义一个数组，直接调用方法报错
感觉可能和js自动装包有点关系
但是每种情况报错文案还不太一样
为什么借用一个变量就ok了 
它们内部机制是什么，求大佬详细讲解下
```
const a = 1
const b = 2
[a,b].forEach(e => {
    console.log(e);
});

//VM409:3 Uncaught ReferenceError: Cannot access 'b' before initialization
```
```
let a = 1
let b = 2
[a,b].forEach(e => {
    console.log(e);
});

//ReferenceError: b is not defined
```
```
var a = 1
var b = 2
[a,b].forEach(e => {
    console.log(e);
});

//VM409:3 VM480:3 Uncaught TypeError: Cannot read property 'forEach' of undefined
```
```
const a = 1
const b = 2
const arr = [a,b]
arr.forEach(e => {
    console.log(e);
});

//1,2  执行成功
```
```
const a = 1
const b = 2
const fn = (e)=>{
     console.log(e);
}
[a,b].forEach(fn);

//1,2  执行成功
```
少写了分号
每一行最后都加上分号
const a = 1;
const b = 2;
分号会和下一行的 [ 连在一起
相当于
```
const b = 2[a,b].forEach(e => {
    console.log(e);
});
```