Why can I still update an array that uses `const`?


#1

Question

Why can I still update an array that uses const?

Answer

So by updating the array’s contents you aren’t redefining the array, which is the loophole. const never lets you redefine a value but it will let you modify it. Note, this concept carries over to all data types but you can’t modify certain data types values, such as with a number which you have to redefine to change.