What is the output?
Anonymous Quiz
48%
Rex makes a sound and barks true Dog
20%
Rex barks false Dog
23%
Rex makes a sound and barks true Animal
9%
Rex makes a sound true Dog
π8π€1
Each year, Devographics runs an epic survey of as many JavaScript community members as it can and turns the results into an interesting report on the state of the ecosystem β hereβs the results from 2024. If you have the time, fill it in, especially as they format it in a way where you can actually learn about stuff as you go.
Devographics
Please open Telegram to view this post
VIEW IN TELEGRAM
π€2β€1π₯1
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
β€5π2π₯1
CHALLENGE
const Flyable = {
fly() { return 'flying'; }
};
const Swimmable = {
swim() { return 'swimming'; }
};
function mixin(Base, ...mixins) {
mixins.forEach(mixin => Object.assign(Base.prototype, mixin));
return Base;
}
class Bird {}
class Fish {}
const FlyingFish = mixin(class extends Fish {}, Flyable, Swimmable);
const instance = new FlyingFish();
console.log(instance.swim());
console.log(instance.fly());
console.log(instance instanceof Fish);
What is the output?
Anonymous Quiz
23%
flying, swimming, false
47%
swimming, flying, true
23%
undefined, undefined, true
6%
swimming, flying, false