JavaScript
32.1K subscribers
1.05K photos
10 videos
33 files
728 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

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
A minimal CheatEngine implementation built with Rust and a terminal UI.

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
What is the output?
Anonymous Quiz
18%
undefined
53%
11
21%
null
8%
NaN
πŸ€”4