javascript
class Monorail {
#value;
#size = 1;
constructor(value) {
this.#value = value;
}
bind(f) {
const newThis = f(this.#value);
if (newThis.#size < this.#size + 1) newThis.#size = this.#size + 1;
console.log(`the glaceon is now ${newThis.#size} meters tall`);
return newThis;
}
};
re: javascript
@aescling using oop in javascript 🤮
re: javascript
@wallhackio .bind
chaining
re: javascript
@aescling makes it better, but still not good enough
re: javascript
@wallhackio we are watching a movie
re: javascript
@aescling but it's the sonic movie
re: javascript
@wallhackio fair
alternatively just use a global
size
variable; we can abuse statefulness fur the funny