Difference between const and let

In this lesson we don’t learn the real difference between const and let. Or am I missing something?

1.

Below the two existing arrays, re-assign the element in index 0 of condiments to 'Mayo' .

Log the updated array, condiments , to the console.

Stuck? Get a hint

2.

Below your code from Step 1, reassign condiments to be a new array that contains a single string ['Mayo']

Log the result to the console.

Notice that you can re-assign elements in an array and re-assign an entire new array to a variable declared using the let keyword.

Stuck? Get a hint

3.

Below your code from Step 2, re-assign the last item from the utensils array to 'Spoon' .

Log the updated array to the console.

can be, what is still unclear at this point?

I’ve added extra code at the end to test the real difference (so you get an error)

utensils = ['Mayo'];
console.log(utensils);
1 Like

That is a good mindset for a programmer, testing a theory by producing an error (when you expect one)

1 Like

…thanks, I think it should be in the lesson.

1 Like

I agree - I think it should be added the lesson in order further clarify the difference between let and const when declaring arrays. Otherwise, the difference is not actually seen.

1 Like

There isn’t that much difference, the variable is either constant or its not. The only difference is that we can mutate the array (because its mutable data)

10 posts were split to a new topic: Difference between const and let not explained