I not understanding the time consts can be used even though the variable value is different across the program. I know it at least can have to do with the scope, it is defined but can get confused beyond that. From looking at a program it appears a scope, is a particular iteration of a loop. For example in below example (taken from Learn Basic Algorithmic Thinking by Building a Number Sorter: Step 45 | freeCodeCamp.org the program I was refering to) it is how come the const key word is used instead of let for temp. I am wrong or partially wrong.
temp exists in that scope only, and does not need to be reassigned or changed
you can start declaring all variables with const, unless you need to declare them without a value, and change them to let if you find out that with const it disallow a thing you need to do
From a test I did I take for a loop the scope is all iterations of the loop. Please let me know if iteration is not a widely understood/ or even correct term and an alternative. Let me know if you don’t know what I mean by iteration and I will explain.
The scope cannot be across all iterations of the loop - each loop iteration has a different value for temp. Therefore, each loop iteration has it’s own scope.
I think I may have not explained myself well here. I could well have but want to be sure. To be clear I was refering to a circumstance like my test variable in the code below.
Right on off chance it was something easier it make have made thing easier. I just focus on this is what the javaScript const key word means and how to use it. If what to consider it not aligning to how you consider, constants you can.