…ferable to use
const for all the identifiers in the program that are not supposed to be reassigned. However, when the identifiers need to be reassigned, programmers should use
let instead. This is generally the case for counters in a loop construct or values swap in algorithm subroutines…
…ipt, it is not about value immutability. It doesn’t indicate that a value is constant or read-only. Instead, it creates an immutable binding and guarantees that no rebinding will happen. With this being said, the following code will throw an error at run-time.