SyntaxFix
Write A Post
Hire A Developer
Questions
Object.withDefault = (defaultValue,o={}) => { return new Proxy(o, { get: (o, k) => (k in o) ? o[k] : defaultValue }); } o = Object.withDefault(42); o.x //=> 42 o.x = 10 o.x //=> 10 o.xx //=> 42