const handler1 = {
  defineProperty(target, key, descriptor) {
    invariant(key, 'define');
    return true;
  },
};

function invariant(key, action) {
  if (key[0] === '_') {
    throw new Error(`Invalid attempt to ${action} private "${key}" property`);
  }
}

const monster1 = {};
const proxy1 = new Proxy(monster1, handler1);

console.log((proxy1._secret = 'easily scared'));
// Expected output: Error: Invalid attempt to define private "_secret" property