> For the complete documentation index, see [llms.txt](https://js201.gitbook.io/js-101/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://js201.gitbook.io/js-101/console/constants.md). Agents can also search and read this documentation through its [MCP server](https://js201.gitbook.io/js-101/~gitbook/mcp).

# Constants

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

### Example:

```javascript
const VERSION = '1.2';
```

### 📝 Task:

* [ ] Run the program mentioned below and fix the error that you see in the console. Make sure that the code result is `0.9` when it is fixed in the console.

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

### 💡 Hints:

* Visit the  [Variables](https://js201.gitbook.io/js-101/basics/variables.md) chapter for more info about const and also look for "*TypeError assignment to constant variable*" in search engines to learn a fix.&#x20;
