Here is my test code (to be run using node --harmony-proxies foo.js
:
var a = Proxy.create({
get : function (proxy, prop)
{
return 5
}
})
console.log(a['foo'])
console.log(a.length)
console.log(a['10'])
console.log(a[10])
Why the last 2 lines fail to print 5, why the proxy fails to intercept properties looking like integers? Is it an implementation bug or is it how it is specified? Is there a separate way to intercept array indices so I can implement my own arrays (e.g. sparse arrays)?