TS2588

error TS2588: Cannot assign to ‘name’ because it is a constant.

Broken Code ❌

1
2
const name = 'Benny';
name = 'Sofia';

Fixed Code ✔️

You cannot reassign values to constants which is why you have to declare a variable using the let keyword:

1
2
let name = 'Benny';
name = 'Sofia';