With regular for loop I can do something like that:
for (let i = 0; i < objects.length; i++) {
delete objects[i];
}
It's not possible with regular for-of loop
for (let o of objects) {
delete o;
}
That will generate such error
SyntaxError: Deleting local variable in strict mode.
And this is expected, o is a copy. So, is there a way to initialize o as a reference? For example, this is how it's done in C++11:
for (auto &o : objects) {
// o is a reference to an object from objects
}