Arrays with const and let Intro to JS 5. exercise

https://www.codecademy.com/courses/introduction-to-javascript/lessons/arrays/exercises/let-const-arrays?action=resume_content_item

So far the course is great. Just wanted to add an extra line to page 5 as the page explain the difference between let and const in relation to arrays.

I just felt that the exercise could do with an extra question
4. Below your code from Step 3, reassign utensils to be a new array that contains a single string [‘Spoon’]

and log the result to the console

You should get a TypeError

The reason as indicated in the page… Meaning that we can change the contents of a const array, but cannot reassign a new array or a different value.

Perhaps this is obvious and I don’t want to waste anyone’s time, just felt that it might be useful to some people:slightly_smiling_face:.
Let’s continue and keep up the good coding work:+1:.

2 Likes