JavaScript
32K subscribers
1.04K photos
10 videos
33 files
718 links
A resourceful newsletter featuring the latest and most important news, articles, books and updates in the world of #javascript 🚀 Don't miss our Quizzes!

Let's chat: @nairihar
Download Telegram
CHALLENGE

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

transform(fn) {
return new DataProcessor(fn(this.value));
}

getValue() {
return this.value;
}
}

const multiply = x => x * 2;
const add = x => x + 10;
const square = x => x * x;

const result = new DataProcessor(5)
.transform(multiply)
.transform(add)
.transform(square)
.getValue();

console.log(result);
1
What is the output?
Anonymous Quiz
22%
300
23%
100
49%
400
6%
625
4👍2🔥1