quickjs icon indicating copy to clipboard operation
quickjs copied to clipboard

Proxy for-in not work

Open dolphinxx opened this issue 2 years ago • 0 comments

The following code does not work in QuickJS, ownKeys and getOwnPropertyDescriptor are called, but the for-in block is never entered.

let target = {}
let proxy = new Proxy(target, {
    ownKeys: function() {
        return ["a", "b"];
    },
    getOwnPropertyDescriptor: function(target, key) {
        return { enumerable: true, configurable: true, value: this[key] };
    }
});
for(let o in proxy) {
  console.log(o);
}
// should print
// a
// b

dolphinxx avatar Oct 25 '22 17:10 dolphinxx