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

function modify(obj) {
obj.a.push(4);
obj.b = 'changed';
return obj;
}

const original = { a: [1, 2, 3], b: 'original', c: { deep: true } };
const copy1 = { ...original };
const copy2 = JSON.parse(JSON.stringify(original));

modify(copy1);
console.log(original.a, original.b, copy2.c === original.c);

Ответ: [1, 2, 3, 4,] 'original' false

JavaScript test | #JavaScript
More from @js_test
  1. Oct 14, 2026❗️Что будет на выходе: const person = { name: 'Alice', greet() { return `Hello, I'm ${this…
  2. Oct 14, 2026❗️Что будет на выходе: const regex = /a/g; const str = 'banana'; console.log(str.match(reg…
  3. Oct 13, 2026❓Что будет на выходе? const sym1 = Symbol('description'); const sym2 = Symbol('description…
  4. Oct 13, 2026❗️Что будет на выходе: function Animal(name) { this.name = name; } Animal.prototype.speak…
  5. Oct 12, 2026❓Что будет на выходе? const p1 = new Promise((resolve) => { console.log("A"); resolve("B")…
  6. Oct 11, 2026❗️Что будет на выходе: const obj = {}; Object.defineProperty(obj, 'name', { value: 'Alice'…
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 →