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

const operations = {
add: (a, b) => a + b,
subtract: (a, b) => a - b,
multiply: (a, b) => a * b,
divide: (a, b) => b !== 0 ? a / b : null,
};

const pipeline = (...fns) => (value) => fns.reduce((acc, fn) => fn(acc), value);

const double = (x) => operations.multiply(x, 2);
const addTen = (x) => operations.add(x, 10);
const halve = (x) => operations.divide(x, 2);
const subtractThree = (x) => operations.subtract(x, 3);

const transform = pipeline(double, addTen, halve, subtractThree);

console.log(transform(5));

Ответ: 7

JavaScript test | #JavaScript & Max
More from @js_test
  1. Sep 20, 2026❗️Что будет на выходе? async function test() { console.log('1'); setTimeout(() => { consol…
  2. Sep 20, 2026❗️Что будет на выходе? const user = { profile: { name: 'Alice', settings: { notifications:…
  3. Sep 20, 2026❗️Что будет на выходе? function* range(start, end) { while (start < end) { yield start++;…
  4. Sep 19, 2026❗️Что будет на выходе: const arr = [3, 8, 12]; const even = (elem) => elem % 2 === 0; cons…
  5. Sep 19, 2026❓Что будет на выходе? const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(..…
  6. Sep 19, 2026❓Что будет на выходе? const obj1 = { a: 1, b: 2 }; const obj2 = { b: 3, c: 4 }; const merg…
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 →