The const on b only applies to the object reference to b, and doesn't prevent foo from changing the contents of b. No doubt that's why the test question includes an array in the first place.
At least I assume that's how const works; I've not used const in JS.