Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavaScriptProxy and ReflectSingle-choice MCQ

What does this Proxy 'has' trap change about the `in` operator and with-style lookups?

const target = { a: 1 }; const p = new Proxy(target, { has(t, key) { if (key.startsWith('_')) return false; return key in t; } }); console.log('a' in p); console.log('_a' in p); target._a = 5; console.log('_a' in p);