# const

A keyword that declares a block-scoped variable that can't be given a new value.

## What is **const** in JavaScript?

**const** — A keyword that declares a block-scoped variable that can't be given a new value. An object or array it
holds can still change.

```javascript
const taxRate = 0.08;
taxRate = 0.1;          // TypeError: Assignment to constant variable.

const cart = [];
cart.push("coffee");    // allowed: the array changes, the variable doesn't
```

Level: Novice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary/subjects/javascript/novice)

Updated: October 19, 2026

## In other subjects

- [const in C#](https://www.ask-codey.com/glossary/const)

Source: https://www.ask-codey.com/glossary/const-javascript
