What is the alternative for the enumerate()
for JavaScript Proxy to trap
for ... in
Since enumerate() is deprecated.
What is the alternative for the enumerate()
for JavaScript Proxy to trap
for ... in
Since enumerate() is deprecated.
Copyright © 2021 Jogjafile Inc.
Negatives make for unsatsifying answers, but unfortunately, I don't believe there's any direct replacement. Although the
ownKeystrap will be triggered by afor-inloop (because its initialization uses the abstractEnumerateObjectPropertiesoperation, which has to get the keys for an object via[[OwnPropertyKeys]]),ownKeyswill also be triggered other times the keys of an object are required, not just when being used in afor-inloop.