Whenever the function gets called, there is a new environment record which stores all the variables declared in the function. A const variable can be stored only once. If you call the function again, there is a new record, and as such the variable can hold another value.
function a() {
const b = Math.random();
// assigning b again here won't work
}
a();
a(); // new record, new value
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…