Incorrect work of 'const' inside while loop
Hello!
May I ask why constants work in ThingWorx differently than in normal JavaScript?
Example:
let i = 5;
while (i > 0) {
const a = i;
logger.warn(a);
i--;
}
In log we will see:
5
5
5
5
5
In any normal JS code runner such as Codepen we will see in console log:
5
4
3
2
1
As far as I understand, such a script execution violates the basic ideology of constants in JavaScript - 'const' is initialized and exists only in the block (loop) scope.
The same behaviour in 'for' loop. 'const' works correctly only in functions like 'map', 'forEach'.
Thank you in advance.

