Constants

Constants were introduced in ES6(2015), and use a const keyword. Variables that are declared with const cannot be reassigned or redeclared.

Example:

const VERSION = '1.2';

📝 Task:

const VERSION = '0.7';
VERSION = '0.9';
console.log(VERSION);

💡 Hints:

  • Visit the Variables chapter for more info about const and also look for "TypeError assignment to constant variable" in search engines to learn a fix.

Last updated

Was this helpful?