CHALLENGE
function Vehicle(type) {
this.type = type;
}
Vehicle.prototype.describe = function() {
return `This is a ${this.type}`;
};
function Car(brand) {
Vehicle.call(this, 'car');
this.brand = brand;
}
Car.prototype = Object.create(Vehicle.prototype);
Car.prototype.constructor = Car;
Car.prototype.describe = function() {
return Vehicle.prototype.describe.call(this) + ` made by ${this.brand}`;
};
const tesla = new Car('Tesla');
console.log(tesla.describe());
console.log(tesla.constructor.name);β€2
What is the output?
Anonymous Quiz
33%
This is a Tesla made by Tesla Car
40%
This is a car made by Tesla Car
16%
This is a Tesla Vehicle
11%
This is a car made by Tesla Vehicle
1β€3π₯2π1
A minimal CheatEngine implementation built with Rust and a terminal UI.
Do you think itβs possible to create something similar with JavaScript?
Do you think itβs possible to create something similar with JavaScript?
β€2π2π₯1π€1
CHALLENGE
const Maybe = {
of: (value) => ({ value, map: f => value == null ? Maybe.nothing() : Maybe.of(f(value)) }),
nothing: () => ({ value: null, map: () => Maybe.nothing() })
};
const result = Maybe.of(5)
.map(x => x * 2)
.map(x => x > 15 ? null : x)
.map(x => x + 1)
.map(x => x.toString());
console.log(result.value);π€5
π€4