const s = [5, 6, 7];
s = [1, 2, 3];
s[2] = 45;
console.log(s);
s = [1, 2, 3] will result in an error. The console.log will display the value [5, 6, 45].
when I ran the code in the console
const s = [5, 6, 7];
s = [1, 2, 3];
s[2] = 45;
console.log(s);
I got an error
VM182:2 Uncaught TypeError: Assignment to constant variable.
at :2:3
I am very much confused why the question says “s = [1, 2, 3] will result in an error. The console.log will display the value [5, 6, 45].” because it gives me an error