I have a task to implement expression 0..II to return [0, 1, 2] (same for all Roman numerals).
I have looked up Proxy object concept and this works fine.
var handler = {
get: function(obj, prop) {
console.log(prop);
x = parseRomanNumeral(prop);
if (x) {
return Array.from(Array(x).keys());
}
},
defineProperty: function(target, property, descriptor) {
console.log('1');
}
}
var target = {};
var proxy = new Proxy(target, handler);
console.log(proxy.II); //[0, 1]
But I don't understand how to do the same with the expression 0..I as 0. is the instance of Number. What should I pass to Proxy constructor?