JSFiddle - React, Tailwind, and code Playground
by WoJWoJ
JavaScript
let defaultDict = new Proxy({}, {
set: (target, name) => {
if (target.name === undefined) { target.name = [] }
}
})
let a = defaultDict
a.hello.push(1)
a.hello.push(2)
a.world.push(1)
console.log(a)