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

class Calculator {
constructor(value) {
this.value = value;
}

add(num) {
this.value += num;
return this;
}

multiply(num) {
this.value *= num;
return this;
}
}

const calc = new Calculator(5);
const addMethod = calc.add;
const result = addMethod.call(calc, 3).multiply(2);
console.log(result.value);

Ответ: 16

JavaScript test | #JavaScript & Max
More from @js_test
  1. Sep 25, 2026❓Что будет на выходе? 'use strict'; function strictModeExample() { undeclaredVariable = 10…
  2. Sep 25, 2026❓Что будет на выходе? function mystery(x) { return (function(y) { return x + y; })(x * 2);…
  3. Sep 24, 2026❗️Что будет на выходе: const str = " Hello, World! "; const result = str .trim() .split(",…
  4. Sep 24, 2026❗️Что будет на выходе: function highlight(strings, ...values) { return strings.reduce((res…
  5. Sep 24, 2026❗️Что будет на выходе: function processData({ a = 10, b = 20 } = { a: 30 }) { console.log(…
  6. Sep 23, 2026❗️Что будет на выходе? const team = { members: ['Alice', 'Bob', 'Charlie'], [Symbol.iterat…
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 →