I think your code might have an error, it should be

```
if ( !Array.isArray(a) ) { 
```
Instead of 
```
if ( !Array.isArray(a) ) { 
```

Hoisting only moves the declaration of the variable to the top of the scope. The assignment stays in the same location.