const arr = [1, 2, 3, 4] const handler = { get(target, prop, receiver) { // try to convert property to a number const n = +prop // if it's a number less than zero, return the correct item from the array if (!isNaN(n) && n<0) { return Reflect.get(target, target.length + n, receiver) // otherwise continue as normal with the property } else { return Reflect.get(...arguments) } } } const myArr = new Proxy(arr, handler) console.log(myArr[0]) // 1 console.log(myArr[2]) // 3 console.log(myArr[-1]) // 4 console.log(myArr[-3]) // 2