by tnzm · 5y ago · 0 comments
Remember, once upon a time JS was supposed to be Scheme...
Your approach can't translate the following code:
class MyNumber {
#value;
constructor(value) { this.#value = value; }
add(other) { return new MyNumber(this.#value + other.#value); }
}
The proper solution is to use a non-enumerable property with an unnamed Symbol name, which is possible but cumbersome.