# FAQ: Variables - Create a Variable: const

This community-built FAQ covers the “Create a Variable: const” exercise from the lesson "Variables ".

Paths and Courses
This exercise can be found in the following Codecademy content:

## FAQs on the exercise Create a Variable: const

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

## Join the Discussion. Help a fellow learner on their journey.

You can also find further discussion and get answers to your questions over in #get-help.

Agree with a comment or answer? Like () to up-vote the contribution!

Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.

Looking for motivation to keep learning? Join our wider discussions in #community

Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Why is keyword const a variable if it cannot be changed? If vriable is something that is liable to change, why is const categorized as it is!

1 Like

If you assign an array or object to a `const` variable, then you can still mutate/modify the array/object. But you can’t change the reference e.g. you can’t assign a new/different array or object.

``````const x = 32;
x = 5; // INVALID

const x = "Hello";
x = "Goodbye" // INVALID
x = "Hello" // INVALID

const x = [32, 11, 99, 3];
x[1] = 100;
x.pop();
console.log(x); // [ 32, 100, 99 ]
x = [12, 5, 2] // INVALID

const x = {price: 23.12, stock: 14, name: "Apple"}
x =  {price: 23.12, stock: 14, name: "Apple"} // INVALID
// Assigning a new object (even if it appears same) will change reference

const x = {price: 23.12, stock: 14, name: "Apple"}
x.price = 25.35;
x["Reviews/Ratings"] = 44;
delete x.stock;
console.log(x); // { price: 25.35, name: 'Apple', 'Reviews/Ratings': 44 }

``````
2 Likes

Thank you for the detailed explanation!

1 Like