At generator.prototype.__proto__.math
, the function's argument sets e = 0
. However, when the gen.math(1)
is called, the value for e
seems to be set to 1 instead of 0. Is the initial e = 0
overwritten by gen.math(1)
or is there something more?
function * generator() {
yield 1;
}
generator.prototype.__proto__.math = function(e = 0) {
return e * Math.PI;
}
generator.prototype.__proto__;
const gen = generator();
gen.math(1); // 3.141592653589793