The code is simple:
const num = 1; num = 2; console.log('num', num);
In JSFiddle, the browser console will show the following error, which is great:
Uncaught TypeError: Assignment to constant variable.
However, the same codes in Angular 2 does not give any error, and at the end
num equals 2. See this Plunker.
Why changing “const” value in Angular 2 does not give error? Is this a bug? Thanks