Do you know what will be the output of this code?
JavaScript
const arr = [1];
arr.push(2);
console.log(arr);
Show answer and explanation
The answer is [1, 2].
const only stops arr from pointing to a different value. The array itself can still be changed. Use Object.freeze to make it read-only.