When using a block scoped variable via "const", the scope seems to be ignored in for loops, causing object references to be re-used. Is this intentional?
var output = [];
for(var x = 0; x < 3; x++)
{
const testvar = { val: 1 };
output.push(testvar.val);
testvar.val = 2;
}
Expected: [1, 1, 1]
Actual: [1, 2, 2]