I declared "sil" as const and give it a value in every loop again and again.
In udemy course instr?ctor pointed that const values cant be changed, so how could it worked?
Every iteration of the loop creates a new environment so every iteration basically has its own sil
variable. You are never assigning a new value to an existing sil
variable (which would not work as already mentioned).
"sil.addEventListener" -> How this listeners function deleted the correct list element?
For the same reason: Every iteration has its own sil
variable. In each iteration a new event handler is created which has access to that variable. The variable holds a reference to the element processed in that iteration of the loop.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…