TGViewer
JavaScript test JavaScript test @js_test · 9.68K subscribers
Post #4998 741
❗️Что будет на выходе?

const obj = {
[Symbol('a')]: 'hidden',
a: 'visible',
[Symbol.for('b')]: 'registered',
b: 123
};

const symbol1 = Symbol.for('b');
const symbol2 = Symbol.for('b');

console.log(obj.a + ', ' +
obj[Symbol('a')] + ', ' +
obj[symbol1] + ', ' +
(symbol1 === symbol2));

Ответ: visible, undefined, registered, true

JavaScript test | #JavaScript
More from @js_test
  1. Oct 15, 2026❗️Что будет на выходе: try { try { // Creating a custom error type class CustomError exten…
  2. Oct 15, 2026❗️Что будет на выходе: const createMathOps = (base) => { return { add: (x) => base + x, mu…
  3. Oct 15, 2026❗️Что будет на выходе: const team = { name: 'Eagles', players: ['Smith', 'Johnson', 'Willi…
  4. Oct 14, 2026❗️Что будет на выходе: function processData({ a = 10, b = 20 } = { a: 30 }) { console.log(…
  5. Oct 14, 2026Как платить за границей и за зарубежные сервисы в 2026 году? Можно переплачивать посредник…
  6. Oct 14, 2026❗️Что будет на выходе: const person = { name: 'Alice', greet() { return `Hello, I'm ${this…
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 →