TGViewer
JavaScript test JavaScript test @js_test · 9.7K subscribers
Post #5380 725
❗️Что будет на выходе:
const target = { name: 'Maya', age: 25 };
const handler = {
get(obj, prop) {
if (prop in obj) {
return obj[prop];
}
return `Property '${prop}' not found`;
},
set(obj, prop, value) {
if (typeof value === 'string') {
obj[prop] = value.toUpperCase();
} else {
obj[prop] = value;
}
return true;
}
};
const proxy = new Proxy(target, handler);
proxy.city = 'tokyo';
console.log(proxy.name);
console.log(proxy.city);
console.log(proxy.country);

Ответ: Maya TOKYO Property 'country' not found

JavaScript test | #JavaScript
More from @js_test
  1. Oct 9, 2026❗️Что будет на выходе: function* gen() { yield 1; yield 2; yield 3; } async function async…
  2. Oct 9, 2026❗️Что будет на выходе: const person = { name: 'Alice', greet() { return `Hello, I'm ${this…
  3. Oct 8, 2026❗️Что будет на выходе: function processData({ a = 10, b = 20 } = { a: 30 }) { console.log(…
  4. Oct 8, 2026Дизайнер, айтишник, продажник или маркетолог – а что, если часть вашей работы заберет Clau…
  5. Oct 7, 2026❗️Что будет на выходе? const team = { members: ['Alice', 'Bob', 'Charlie'], [Symbol.iterat…
  6. Oct 7, 2026❗️Что будет на выходе: function processConfig(config) { const cache = config.cache ?? true…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →